Paste P479

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Oct 16 2019, 4:24 PM.
diff --git a/src/kstatusnotifieritem.cpp b/src/kstatusnotifieritem.cpp
index ded75b4..20d14a1 100644
--- a/src/kstatusnotifieritem.cpp
+++ b/src/kstatusnotifieritem.cpp
@@ -70,9 +70,6 @@ KStatusNotifierItem::~KStatusNotifierItem()
delete d->statusNotifierWatcher;
delete d->notificationsClient;
delete d->systemTrayIcon;
- if (!qApp->closingDown()) {
- delete d->menu;
- }
if (d->associatedWidget) {
KWindowSystem::self()->disconnect(d->associatedWidget);
}
@@ -420,7 +417,9 @@ void KStatusNotifierItem::setContextMenu(QMenu *menu)
{
if (d->menu && d->menu != menu) {
d->menu->removeEventFilter(this);
- delete d->menu;
+ if (menu->parent() == this) {
+ delete d->menu;
+ }
}
if (!menu) {
@@ -450,7 +449,7 @@ void KStatusNotifierItem::setContextMenu(QMenu *menu)
d->menu = menu;
Qt::WindowFlags oldFlags = d->menu->windowFlags();
- d->menu->setParent(nullptr);
+ d->menu->setParent(this);
d->menu->setWindowFlags(oldFlags);
}
davidedmundson edited the content of this paste. (Show Details)Oct 16 2019, 4:24 PM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.