From: Claudio Cambra Date: Wed, 14 Sep 2022 10:25:56 +0000 (+0200) Subject: Deallocate call notification dialog objects when closed X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~14^2~49^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=dfb52987ea2d9fde21a921bd07a4d8514c88582d;p=nextcloud-desktop.git Deallocate call notification dialog objects when closed Signed-off-by: Claudio Cambra --- diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index e1dbee179..215d43dec 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -232,6 +232,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; @@ -271,6 +277,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