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~11^2~267^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5a56584fbad94118fa46eae76f865f5835c1d6ad;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 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