forked from quickshell/quickshell
core/menu: correctly handle menu destruction while open
This commit is contained in:
parent
26280b34b4
commit
2d05c7a89e
1 changed files with 12 additions and 2 deletions
|
@ -78,8 +78,17 @@ void QsMenuAnchor::onClosed() {
|
||||||
this->platformMenu = nullptr;
|
this->platformMenu = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject::disconnect(this->mMenu, &QsMenuHandle::menuChanged, this, &QsMenuAnchor::onMenuChanged);
|
if (this->mMenu) {
|
||||||
this->mMenu->unrefHandle();
|
QObject::disconnect(
|
||||||
|
this->mMenu,
|
||||||
|
&QsMenuHandle::menuChanged,
|
||||||
|
this,
|
||||||
|
&QsMenuAnchor::onMenuChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
this->mMenu->unrefHandle();
|
||||||
|
}
|
||||||
|
|
||||||
emit this->closed();
|
emit this->closed();
|
||||||
emit this->visibleChanged();
|
emit this->visibleChanged();
|
||||||
}
|
}
|
||||||
|
@ -109,6 +118,7 @@ bool QsMenuAnchor::isVisible() const { return this->mOpen; }
|
||||||
|
|
||||||
void QsMenuAnchor::onMenuDestroyed() {
|
void QsMenuAnchor::onMenuDestroyed() {
|
||||||
this->mMenu = nullptr;
|
this->mMenu = nullptr;
|
||||||
|
this->onClosed();
|
||||||
emit this->menuChanged();
|
emit this->menuChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue