mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Don't leak dialogs
It seems that you need to manually destroy created objects... Great... fixes #898
This commit is contained in:
parent
609cd82dc0
commit
ff4334d59e
10 changed files with 52 additions and 5 deletions
|
@ -54,6 +54,7 @@ Rectangle {
|
||||||
} else {
|
} else {
|
||||||
var dialog = placeCallDialog.createObject(timelineRoot);
|
var dialog = placeCallDialog.createObject(timelineRoot);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,6 +226,7 @@ Item {
|
||||||
forwardMess.setMessageEventId(chat.model.reply);
|
forwardMess.setMessageEventId(chat.model.reply);
|
||||||
forwardMess.open();
|
forwardMess.open();
|
||||||
chat.model.reply = null;
|
chat.model.reply = null;
|
||||||
|
timelineRoot.destroyOnClose(forwardMess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,6 +654,7 @@ Item {
|
||||||
var forwardMess = forwardCompleterComponent.createObject(timelineRoot);
|
var forwardMess = forwardCompleterComponent.createObject(timelineRoot);
|
||||||
forwardMess.setMessageEventId(messageContextMenu.eventId);
|
forwardMess.setMessageEventId(messageContextMenu.eventId);
|
||||||
forwardMess.open();
|
forwardMess.open();
|
||||||
|
timelineRoot.destroyOnClose(forwardMess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -394,6 +394,7 @@ Page {
|
||||||
"profile": Nheko.currentUser
|
"profile": Nheko.currentUser
|
||||||
});
|
});
|
||||||
userProfile.show();
|
userProfile.show();
|
||||||
|
timelineRoot.destroyOnClose(userProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -670,6 +671,7 @@ Page {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var win = roomDirectoryComponent.createObject(timelineRoot);
|
var win = roomDirectoryComponent.createObject(timelineRoot);
|
||||||
win.show();
|
win.show();
|
||||||
|
timelineRoot.destroyOnClose(win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,6 +690,7 @@ Page {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
|
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
|
||||||
quickSwitch.open();
|
quickSwitch.open();
|
||||||
|
timelineRoot.destroyOnClose(quickSwitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,13 @@ Pane {
|
||||||
id: fontMetrics
|
id: fontMetrics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Timer {
|
||||||
|
// onTriggered: gc()
|
||||||
|
// interval: 1000
|
||||||
|
// running: true
|
||||||
|
// repeat: true
|
||||||
|
//}
|
||||||
|
|
||||||
EmojiPicker {
|
EmojiPicker {
|
||||||
id: emojiPopup
|
id: emojiPopup
|
||||||
|
|
||||||
|
@ -166,6 +173,7 @@ Pane {
|
||||||
onActivated: {
|
onActivated: {
|
||||||
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
|
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
|
||||||
quickSwitch.open();
|
quickSwitch.open();
|
||||||
|
destroyOnClose(quickSwitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,11 +197,13 @@ Pane {
|
||||||
function onOpenLogoutDialog() {
|
function onOpenLogoutDialog() {
|
||||||
var dialog = logoutDialog.createObject(timelineRoot);
|
var dialog = logoutDialog.createObject(timelineRoot);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOpenJoinRoomDialog() {
|
function onOpenJoinRoomDialog() {
|
||||||
var dialog = joinRoomDialog.createObject(timelineRoot);
|
var dialog = joinRoomDialog.createObject(timelineRoot);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
target: Nheko
|
target: Nheko
|
||||||
|
@ -205,17 +215,23 @@ Pane {
|
||||||
"flow": flow
|
"flow": flow
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
target: VerificationManager
|
target: VerificationManager
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function destroyOnClose(obj) {
|
||||||
|
obj.closing.connect(() => obj.destroy());
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onOpenProfile(profile) {
|
function onOpenProfile(profile) {
|
||||||
var userProfile = userProfileComponent.createObject(timelineRoot, {
|
var userProfile = userProfileComponent.createObject(timelineRoot, {
|
||||||
"profile": profile
|
"profile": profile
|
||||||
});
|
});
|
||||||
userProfile.show();
|
userProfile.show();
|
||||||
|
destroyOnClose(userProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onShowImagePackSettings(room, packlist) {
|
function onShowImagePackSettings(room, packlist) {
|
||||||
|
@ -224,6 +240,7 @@ Pane {
|
||||||
"packlist": packlist
|
"packlist": packlist
|
||||||
});
|
});
|
||||||
packSet.show();
|
packSet.show();
|
||||||
|
destroyOnClose(packSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOpenRoomMembersDialog(members, room) {
|
function onOpenRoomMembersDialog(members, room) {
|
||||||
|
@ -232,6 +249,7 @@ Pane {
|
||||||
"room": room
|
"room": room
|
||||||
});
|
});
|
||||||
membersDialog.show();
|
membersDialog.show();
|
||||||
|
destroyOnClose(membersDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOpenRoomSettingsDialog(settings) {
|
function onOpenRoomSettingsDialog(settings) {
|
||||||
|
@ -239,6 +257,7 @@ Pane {
|
||||||
"roomSettings": settings
|
"roomSettings": settings
|
||||||
});
|
});
|
||||||
roomSettings.show();
|
roomSettings.show();
|
||||||
|
destroyOnClose(roomSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOpenInviteUsersDialog(invitees) {
|
function onOpenInviteUsersDialog(invitees) {
|
||||||
|
@ -248,6 +267,7 @@ Pane {
|
||||||
"invitees": invitees
|
"invitees": invitees
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOpenLeaveRoomDialog(roomid) {
|
function onOpenLeaveRoomDialog(roomid) {
|
||||||
|
@ -255,6 +275,7 @@ Pane {
|
||||||
"roomId": roomid
|
"roomId": roomid
|
||||||
});
|
});
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onShowImageOverlay(room, eventId, url, proportionalHeight, originalWidth) {
|
function onShowImageOverlay(room, eventId, url, proportionalHeight, originalWidth) {
|
||||||
|
@ -264,6 +285,7 @@ Pane {
|
||||||
"url": url
|
"url": url
|
||||||
});
|
});
|
||||||
dialog.showFullScreen();
|
dialog.showFullScreen();
|
||||||
|
destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
target: TimelineManager
|
target: TimelineManager
|
||||||
|
@ -274,6 +296,7 @@ Pane {
|
||||||
if (CallManager.haveCallInvite && Settings.mobileMode) {
|
if (CallManager.haveCallInvite && Settings.mobileMode) {
|
||||||
var dialog = mobileCallInviteDialog.createObject(msgView);
|
var dialog = mobileCallInviteDialog.createObject(msgView);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,6 +261,7 @@ Item {
|
||||||
"room": room
|
"room": room
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onShowRawMessageDialog(rawMessage) {
|
function onShowRawMessageDialog(rawMessage) {
|
||||||
|
@ -268,6 +269,7 @@ Item {
|
||||||
"rawMessage": rawMessage
|
"rawMessage": rawMessage
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
target: room
|
target: room
|
||||||
|
|
|
@ -71,6 +71,7 @@ ApplicationWindow {
|
||||||
"imagePack": packlist.newPack(false)
|
"imagePack": packlist.newPack(false)
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
width: packlistC.width
|
width: packlistC.width
|
||||||
visible: !packlist.containsAccountPack
|
visible: !packlist.containsAccountPack
|
||||||
|
@ -84,6 +85,7 @@ ApplicationWindow {
|
||||||
"imagePack": packlist.newPack(true)
|
"imagePack": packlist.newPack(true)
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
width: packlistC.width
|
width: packlistC.width
|
||||||
visible: room.permissions.canChange(MtxEvent.ImagePackInRoom)
|
visible: room.permissions.canChange(MtxEvent.ImagePackInRoom)
|
||||||
|
@ -199,6 +201,7 @@ ApplicationWindow {
|
||||||
"imagePack": currentPack
|
"imagePack": currentPack
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,7 @@ Popup {
|
||||||
"image": ":/icons/icons/ui/place-call.svg"
|
"image": ":/icons/icons/ui/place-call.svg"
|
||||||
});
|
});
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -83,6 +83,7 @@ Rectangle {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var dialog = devicesDialog.createObject(timelineRoot);
|
var dialog = devicesDialog.createObject(timelineRoot);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ Rectangle {
|
||||||
"image": ":/icons/icons/ui/place-call.svg"
|
"image": ":/icons/icons/ui/place-call.svg"
|
||||||
});
|
});
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
return ;
|
return ;
|
||||||
} else if (!CallManager.mics.includes(Settings.microphone)) {
|
} else if (!CallManager.mics.includes(Settings.microphone)) {
|
||||||
var dialog = deviceError.createObject(timelineRoot, {
|
var dialog = deviceError.createObject(timelineRoot, {
|
||||||
|
@ -105,6 +107,7 @@ Rectangle {
|
||||||
"image": ":/icons/icons/ui/place-call.svg"
|
"image": ":/icons/icons/ui/place-call.svg"
|
||||||
});
|
});
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
if (CallManager.callType == CallType.VIDEO && CallManager.cameras.length > 0 && !CallManager.cameras.includes(Settings.camera)) {
|
if (CallManager.callType == CallType.VIDEO && CallManager.cameras.length > 0 && !CallManager.cameras.includes(Settings.camera)) {
|
||||||
|
@ -113,6 +116,7 @@ Rectangle {
|
||||||
"image": ":/icons/icons/ui/video.svg"
|
"image": ":/icons/icons/ui/video.svg"
|
||||||
});
|
});
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
CallManager.acceptInvite();
|
CallManager.acceptInvite();
|
||||||
|
|
|
@ -66,6 +66,7 @@ Popup {
|
||||||
"image": ":/icons/icons/ui/place-call.svg"
|
"image": ":/icons/icons/ui/place-call.svg"
|
||||||
});
|
});
|
||||||
dialog.open();
|
dialog.open();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -118,6 +119,7 @@ Popup {
|
||||||
var dialog = screenShareDialog.createObject(timelineRoot);
|
var dialog = screenShareDialog.createObject(timelineRoot);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
close();
|
close();
|
||||||
|
timelineRoot.destroyOnClose(dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,28 +183,31 @@ TimelineViewManager::openRoomMembers(TimelineModel *room)
|
||||||
{
|
{
|
||||||
if (!room)
|
if (!room)
|
||||||
return;
|
return;
|
||||||
MemberList *memberList = new MemberList(room->roomId(), this);
|
MemberList *memberList = new MemberList(room->roomId());
|
||||||
|
QQmlEngine::setObjectOwnership(memberList, QQmlEngine::JavaScriptOwnership);
|
||||||
emit openRoomMembersDialog(memberList, room);
|
emit openRoomMembersDialog(memberList, room);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineViewManager::openRoomSettings(QString room_id)
|
TimelineViewManager::openRoomSettings(QString room_id)
|
||||||
{
|
{
|
||||||
RoomSettings *settings = new RoomSettings(room_id, this);
|
RoomSettings *settings = new RoomSettings(room_id);
|
||||||
connect(rooms_->getRoomById(room_id).data(),
|
connect(rooms_->getRoomById(room_id).data(),
|
||||||
&TimelineModel::roomAvatarUrlChanged,
|
&TimelineModel::roomAvatarUrlChanged,
|
||||||
settings,
|
settings,
|
||||||
&RoomSettings::avatarChanged);
|
&RoomSettings::avatarChanged);
|
||||||
|
QQmlEngine::setObjectOwnership(settings, QQmlEngine::JavaScriptOwnership);
|
||||||
emit openRoomSettingsDialog(settings);
|
emit openRoomSettingsDialog(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineViewManager::openInviteUsers(QString roomId)
|
TimelineViewManager::openInviteUsers(QString roomId)
|
||||||
{
|
{
|
||||||
InviteesModel *model = new InviteesModel{this};
|
InviteesModel *model = new InviteesModel{};
|
||||||
connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
|
connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
|
||||||
emit inviteUsers(roomId, model->mxids());
|
emit inviteUsers(roomId, model->mxids());
|
||||||
});
|
});
|
||||||
|
QQmlEngine::setObjectOwnership(model, QQmlEngine::JavaScriptOwnership);
|
||||||
emit openInviteUsersDialog(model);
|
emit openInviteUsersDialog(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +215,7 @@ void
|
||||||
TimelineViewManager::openGlobalUserProfile(QString userId)
|
TimelineViewManager::openGlobalUserProfile(QString userId)
|
||||||
{
|
{
|
||||||
UserProfile *profile = new UserProfile{QString{}, userId, this};
|
UserProfile *profile = new UserProfile{QString{}, userId, this};
|
||||||
|
QQmlEngine::setObjectOwnership(profile, QQmlEngine::JavaScriptOwnership);
|
||||||
emit openProfile(profile);
|
emit openProfile(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,8 +273,10 @@ TimelineViewManager::openImageOverlay(TimelineModel *room, QString mxcUrl, QStri
|
||||||
void
|
void
|
||||||
TimelineViewManager::openImagePackSettings(QString roomid)
|
TimelineViewManager::openImagePackSettings(QString roomid)
|
||||||
{
|
{
|
||||||
auto room = rooms_->getRoomById(roomid).get();
|
auto room = rooms_->getRoomById(roomid).get();
|
||||||
emit showImagePackSettings(room, new ImagePackListModel(roomid.toStdString(), this));
|
auto model = new ImagePackListModel(roomid.toStdString());
|
||||||
|
QQmlEngine::setObjectOwnership(model, QQmlEngine::JavaScriptOwnership);
|
||||||
|
emit showImagePackSettings(room, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue