forked from quickshell/quickshell
service/tray: fix crash when display is called on a menuless item
This commit is contained in:
parent
b4be383695
commit
fdbb490537
1 changed files with 6 additions and 0 deletions
|
@ -109,6 +109,12 @@ void SystemTrayItem::scroll(qint32 delta, bool horizontal) const {
|
||||||
|
|
||||||
void SystemTrayItem::display(QObject* parentWindow, qint32 relativeX, qint32 relativeY) {
|
void SystemTrayItem::display(QObject* parentWindow, qint32 relativeX, qint32 relativeY) {
|
||||||
this->item->refMenu();
|
this->item->refMenu();
|
||||||
|
if (!this->item->menu()) {
|
||||||
|
this->item->unrefMenu();
|
||||||
|
qCritical() << "No menu present for" << this;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto* platform = new PlatformMenuEntry(&this->item->menu()->rootItem);
|
auto* platform = new PlatformMenuEntry(&this->item->menu()->rootItem);
|
||||||
|
|
||||||
QObject::connect(&this->item->menu()->rootItem, &DBusMenuItem::layoutUpdated, platform, [=]() {
|
QObject::connect(&this->item->menu()->rootItem, &DBusMenuItem::layoutUpdated, platform, [=]() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue