summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/MessageInput.qml1
-rw-r--r--resources/qml/MessageView.qml2
-rw-r--r--resources/qml/RoomList.qml3
-rw-r--r--resources/qml/Root.qml23
-rw-r--r--resources/qml/TimelineView.qml2
-rw-r--r--resources/qml/dialogs/ImagePackSettingsDialog.qml3
-rw-r--r--resources/qml/voip/CallInvite.qml1
-rw-r--r--resources/qml/voip/CallInviteBar.qml4
-rw-r--r--resources/qml/voip/PlaceCall.qml2
9 files changed, 41 insertions, 0 deletions
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index 7ad4ef69..dd888ab1 100644
--- a/resources/qml/MessageInput.qml
+++ b/resources/qml/MessageInput.qml
@@ -54,6 +54,7 @@ Rectangle {
                     } else {
                         var dialog = placeCallDialog.createObject(timelineRoot);
                         dialog.open();
+                        timelineRoot.destroyOnClose(dialog);
                     }
                 }
             }
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index e801f2d1..542304d8 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -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);
             }
         }
 
diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml
index b1d09eb1..1e7f0c36 100644
--- a/resources/qml/RoomList.qml
+++ b/resources/qml/RoomList.qml
@@ -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);
                     }
                 }
 
diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml
index 88d3e7c6..f9da6b7b 100644
--- a/resources/qml/Root.qml
+++ b/resources/qml/Root.qml
@@ -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);
             }
         }
 
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index b04ca8f6..1933baeb 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -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
diff --git a/resources/qml/dialogs/ImagePackSettingsDialog.qml b/resources/qml/dialogs/ImagePackSettingsDialog.qml
index 18c32c41..2ce19b80 100644
--- a/resources/qml/dialogs/ImagePackSettingsDialog.qml
+++ b/resources/qml/dialogs/ImagePackSettingsDialog.qml
@@ -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);
                         }
                     }
 
diff --git a/resources/qml/voip/CallInvite.qml b/resources/qml/voip/CallInvite.qml
index a17e18d5..3bf7c4cd 100644
--- a/resources/qml/voip/CallInvite.qml
+++ b/resources/qml/voip/CallInvite.qml
@@ -136,6 +136,7 @@ Popup {
                         "image": ":/icons/icons/ui/place-call.svg"
                     });
                     dialog.open();
+                    timelineRoot.destroyOnClose(dialog);
                     return false;
                 }
                 return true;
diff --git a/resources/qml/voip/CallInviteBar.qml b/resources/qml/voip/CallInviteBar.qml
index b2c2dbad..ab377ca8 100644
--- a/resources/qml/voip/CallInviteBar.qml
+++ b/resources/qml/voip/CallInviteBar.qml
@@ -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();
diff --git a/resources/qml/voip/PlaceCall.qml b/resources/qml/voip/PlaceCall.qml
index 1404adf9..2639f5bb 100644
--- a/resources/qml/voip/PlaceCall.qml
+++ b/resources/qml/voip/PlaceCall.qml
@@ -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);
                 }
             }