Deallocate call notification dialog objects when closed

Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
This commit is contained in:
Claudio Cambra 2022-09-14 12:25:56 +02:00
parent 4fcef4edbc
commit 5a56584fba
3 changed files with 14 additions and 0 deletions

View file

@ -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);
}

View file

@ -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();

View file

@ -48,6 +48,8 @@ Window {
callStateChecker.checking = false;
ringSound.stop();
root.close();
Systray.destroyDialog(root);
}
width: root.windowWidth