mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +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 {
|
||||
var dialog = placeCallDialog.createObject(timelineRoot);
|
||||
dialog.open();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,6 +226,7 @@ Item {
|
|||
forwardMess.setMessageEventId(chat.model.reply);
|
||||
forwardMess.open();
|
||||
chat.model.reply = null;
|
||||
timelineRoot.destroyOnClose(forwardMess);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -653,6 +654,7 @@ Item {
|
|||
var forwardMess = forwardCompleterComponent.createObject(timelineRoot);
|
||||
forwardMess.setMessageEventId(messageContextMenu.eventId);
|
||||
forwardMess.open();
|
||||
timelineRoot.destroyOnClose(forwardMess);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -394,6 +394,7 @@ Page {
|
|||
"profile": Nheko.currentUser
|
||||
});
|
||||
userProfile.show();
|
||||
timelineRoot.destroyOnClose(userProfile);
|
||||
}
|
||||
|
||||
|
||||
|
@ -670,6 +671,7 @@ Page {
|
|||
onClicked: {
|
||||
var win = roomDirectoryComponent.createObject(timelineRoot);
|
||||
win.show();
|
||||
timelineRoot.destroyOnClose(win);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -688,6 +690,7 @@ Page {
|
|||
onClicked: {
|
||||
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
|
||||
quickSwitch.open();
|
||||
timelineRoot.destroyOnClose(quickSwitch);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,13 @@ Pane {
|
|||
id: fontMetrics
|
||||
}
|
||||
|
||||
//Timer {
|
||||
// onTriggered: gc()
|
||||
// interval: 1000
|
||||
// running: true
|
||||
// repeat: true
|
||||
//}
|
||||
|
||||
EmojiPicker {
|
||||
id: emojiPopup
|
||||
|
||||
|
@ -166,6 +173,7 @@ Pane {
|
|||
onActivated: {
|
||||
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
|
||||
quickSwitch.open();
|
||||
destroyOnClose(quickSwitch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,11 +197,13 @@ Pane {
|
|||
function onOpenLogoutDialog() {
|
||||
var dialog = logoutDialog.createObject(timelineRoot);
|
||||
dialog.open();
|
||||
destroyOnClose(dialog);
|
||||
}
|
||||
|
||||
function onOpenJoinRoomDialog() {
|
||||
var dialog = joinRoomDialog.createObject(timelineRoot);
|
||||
dialog.show();
|
||||
destroyOnClose(dialog);
|
||||
}
|
||||
|
||||
target: Nheko
|
||||
|
@ -205,17 +215,23 @@ Pane {
|
|||
"flow": flow
|
||||
});
|
||||
dialog.show();
|
||||
destroyOnClose(dialog);
|
||||
}
|
||||
|
||||
target: VerificationManager
|
||||
}
|
||||
|
||||
function destroyOnClose(obj) {
|
||||
obj.closing.connect(() => obj.destroy());
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onOpenProfile(profile) {
|
||||
var userProfile = userProfileComponent.createObject(timelineRoot, {
|
||||
"profile": profile
|
||||
});
|
||||
userProfile.show();
|
||||
destroyOnClose(userProfile);
|
||||
}
|
||||
|
||||
function onShowImagePackSettings(room, packlist) {
|
||||
|
@ -224,6 +240,7 @@ Pane {
|
|||
"packlist": packlist
|
||||
});
|
||||
packSet.show();
|
||||
destroyOnClose(packSet);
|
||||
}
|
||||
|
||||
function onOpenRoomMembersDialog(members, room) {
|
||||
|
@ -232,6 +249,7 @@ Pane {
|
|||
"room": room
|
||||
});
|
||||
membersDialog.show();
|
||||
destroyOnClose(membersDialog);
|
||||
}
|
||||
|
||||
function onOpenRoomSettingsDialog(settings) {
|
||||
|
@ -239,6 +257,7 @@ Pane {
|
|||
"roomSettings": settings
|
||||
});
|
||||
roomSettings.show();
|
||||
destroyOnClose(roomSettings);
|
||||
}
|
||||
|
||||
function onOpenInviteUsersDialog(invitees) {
|
||||
|
@ -248,6 +267,7 @@ Pane {
|
|||
"invitees": invitees
|
||||
});
|
||||
dialog.show();
|
||||
destroyOnClose(dialog);
|
||||
}
|
||||
|
||||
function onOpenLeaveRoomDialog(roomid) {
|
||||
|
@ -255,6 +275,7 @@ Pane {
|
|||
"roomId": roomid
|
||||
});
|
||||
dialog.open();
|
||||
destroyOnClose(dialog);
|
||||
}
|
||||
|
||||
function onShowImageOverlay(room, eventId, url, proportionalHeight, originalWidth) {
|
||||
|
@ -264,6 +285,7 @@ Pane {
|
|||
"url": url
|
||||
});
|
||||
dialog.showFullScreen();
|
||||
destroyOnClose(dialog);
|
||||
}
|
||||
|
||||
target: TimelineManager
|
||||
|
@ -274,6 +296,7 @@ Pane {
|
|||
if (CallManager.haveCallInvite && Settings.mobileMode) {
|
||||
var dialog = mobileCallInviteDialog.createObject(msgView);
|
||||
dialog.open();
|
||||
destroyOnClose(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -261,6 +261,7 @@ Item {
|
|||
"room": room
|
||||
});
|
||||
dialog.show();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
}
|
||||
|
||||
function onShowRawMessageDialog(rawMessage) {
|
||||
|
@ -268,6 +269,7 @@ Item {
|
|||
"rawMessage": rawMessage
|
||||
});
|
||||
dialog.show();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
}
|
||||
|
||||
target: room
|
||||
|
|
|
@ -71,6 +71,7 @@ ApplicationWindow {
|
|||
"imagePack": packlist.newPack(false)
|
||||
});
|
||||
dialog.show();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
}
|
||||
width: packlistC.width
|
||||
visible: !packlist.containsAccountPack
|
||||
|
@ -84,6 +85,7 @@ ApplicationWindow {
|
|||
"imagePack": packlist.newPack(true)
|
||||
});
|
||||
dialog.show();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
}
|
||||
width: packlistC.width
|
||||
visible: room.permissions.canChange(MtxEvent.ImagePackInRoom)
|
||||
|
@ -199,6 +201,7 @@ ApplicationWindow {
|
|||
"imagePack": currentPack
|
||||
});
|
||||
dialog.show();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ Popup {
|
|||
"image": ":/icons/icons/ui/place-call.svg"
|
||||
});
|
||||
dialog.open();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -83,6 +83,7 @@ Rectangle {
|
|||
onClicked: {
|
||||
var dialog = devicesDialog.createObject(timelineRoot);
|
||||
dialog.open();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,6 +99,7 @@ Rectangle {
|
|||
"image": ":/icons/icons/ui/place-call.svg"
|
||||
});
|
||||
dialog.open();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
return ;
|
||||
} else if (!CallManager.mics.includes(Settings.microphone)) {
|
||||
var dialog = deviceError.createObject(timelineRoot, {
|
||||
|
@ -105,6 +107,7 @@ Rectangle {
|
|||
"image": ":/icons/icons/ui/place-call.svg"
|
||||
});
|
||||
dialog.open();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
return ;
|
||||
}
|
||||
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"
|
||||
});
|
||||
dialog.open();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
return ;
|
||||
}
|
||||
CallManager.acceptInvite();
|
||||
|
|
|
@ -66,6 +66,7 @@ Popup {
|
|||
"image": ":/icons/icons/ui/place-call.svg"
|
||||
});
|
||||
dialog.open();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -118,6 +119,7 @@ Popup {
|
|||
var dialog = screenShareDialog.createObject(timelineRoot);
|
||||
dialog.open();
|
||||
close();
|
||||
timelineRoot.destroyOnClose(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -183,28 +183,31 @@ TimelineViewManager::openRoomMembers(TimelineModel *room)
|
|||
{
|
||||
if (!room)
|
||||
return;
|
||||
MemberList *memberList = new MemberList(room->roomId(), this);
|
||||
MemberList *memberList = new MemberList(room->roomId());
|
||||
QQmlEngine::setObjectOwnership(memberList, QQmlEngine::JavaScriptOwnership);
|
||||
emit openRoomMembersDialog(memberList, room);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::openRoomSettings(QString room_id)
|
||||
{
|
||||
RoomSettings *settings = new RoomSettings(room_id, this);
|
||||
RoomSettings *settings = new RoomSettings(room_id);
|
||||
connect(rooms_->getRoomById(room_id).data(),
|
||||
&TimelineModel::roomAvatarUrlChanged,
|
||||
settings,
|
||||
&RoomSettings::avatarChanged);
|
||||
QQmlEngine::setObjectOwnership(settings, QQmlEngine::JavaScriptOwnership);
|
||||
emit openRoomSettingsDialog(settings);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::openInviteUsers(QString roomId)
|
||||
{
|
||||
InviteesModel *model = new InviteesModel{this};
|
||||
InviteesModel *model = new InviteesModel{};
|
||||
connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
|
||||
emit inviteUsers(roomId, model->mxids());
|
||||
});
|
||||
QQmlEngine::setObjectOwnership(model, QQmlEngine::JavaScriptOwnership);
|
||||
emit openInviteUsersDialog(model);
|
||||
}
|
||||
|
||||
|
@ -212,6 +215,7 @@ void
|
|||
TimelineViewManager::openGlobalUserProfile(QString userId)
|
||||
{
|
||||
UserProfile *profile = new UserProfile{QString{}, userId, this};
|
||||
QQmlEngine::setObjectOwnership(profile, QQmlEngine::JavaScriptOwnership);
|
||||
emit openProfile(profile);
|
||||
}
|
||||
|
||||
|
@ -270,7 +274,9 @@ void
|
|||
TimelineViewManager::openImagePackSettings(QString roomid)
|
||||
{
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue