service/tray: disconnect menu from handle on deletion

Fixes loaded being set to true after deleting the menu.
This commit is contained in:
outfoxxed 2024-09-15 15:32:01 -07:00
parent bdc9fe958b
commit 84e3f04f3c
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -545,6 +545,9 @@ void DBusMenuHandle::onMenuPathChanged() {
qCDebug(logDbusMenu) << "Updating" << this << "with refcount" << this->refcount;
if (this->mMenu) {
// Without this, layout updated can be sent after mMenu is set to null,
// leaving loaded = true while mMenu = nullptr.
QObject::disconnect(&this->mMenu->rootItem, nullptr, this, nullptr);
this->mMenu->deleteLater();
this->mMenu = nullptr;
this->loaded = false;