diff options
author | Claudio Cambra <claudio.cambra@gmail.com> | 2022-09-14 13:25:56 +0300 |
---|---|---|
committer | Claudio Cambra <claudio.cambra@gmail.com> | 2022-09-14 13:34:47 +0300 |
commit | 5a56584fbad94118fa46eae76f865f5835c1d6ad (patch) | |
tree | 95743157f82defe90548fe888aa25dfe3bcdf4a9 /src | |
parent | 4fcef4edbc648eecf7abc30eaa30dba7e45b196a (diff) |
Deallocate call notification dialog objects when closed
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/systray.cpp | 8 | ||||
-rw-r--r-- | src/gui/systray.h | 4 | ||||
-rw-r--r-- | src/gui/tray/CallNotificationDialog.qml | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 6f6189dd1..238406474 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -205,6 +205,12 @@ void Systray::setupContextMenu() }); } +void Systray::destroyDialog(QQuickWindow *dialog) const +{ + dialog->destroy(); + dialog->deleteLater(); +} + void Systray::createCallDialog(const Activity &callNotification, const AccountStatePtr accountState) { qCDebug(lcSystray) << "Starting a new call dialog for notification with id: " << callNotification._id << "with text: " << callNotification._subject; @@ -244,6 +250,8 @@ void Systray::createCallDialog(const Activity &callNotification, const AccountSt return; } + // This call dialog gets deallocated on close conditions + // by a call from the QML side to the destroyDialog slot callDialog->createWithInitialProperties(initialProperties); _callsAlreadyNotified.insert(callNotification._id); } diff --git a/src/gui/systray.h b/src/gui/systray.h index 945f5999b..2b1db4ce2 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -118,6 +118,10 @@ public slots: void positionWindowAtScreenCenter(QQuickWindow *window) const; void positionNotificationWindow(QQuickWindow *window) const; + // Do not use this for QQuickWindow components managed by the QML engine, + // only for those managed by the C++ engine + void destroyDialog(QQuickWindow *window) const; + void showWindow(WindowPosition position = WindowPosition::Default); void hideWindow(); diff --git a/src/gui/tray/CallNotificationDialog.qml b/src/gui/tray/CallNotificationDialog.qml index 23d9e2bc8..37929e824 100644 --- a/src/gui/tray/CallNotificationDialog.qml +++ b/src/gui/tray/CallNotificationDialog.qml @@ -48,6 +48,8 @@ Window { callStateChecker.checking = false; ringSound.stop(); root.close(); + + Systray.destroyDialog(root); } width: root.windowWidth |