4.11.1-icontasks-spin-event-loop.patch 1.7 KB
Newer Older
Fabian's avatar
Fabian committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
commit 7c3011e0a6459c00cf9d06d74da3a32f87f1a2f6
Author: Eike Hein <hein@kde.org>
Date:   Mon Sep 9 23:12:45 2013 +0200

    Spin the event loop before destroying the menu.
    
    This allows the menu implementation to complete toggling the
    launcher before the instance is destroyed. It's extremely un-
    fortunate that the library currently requires this careful
    handling; see e944d7ae in kde-workspace for a note on what
    needs to be cleaned up there.
    
    BUG:324661

diff --git a/applets/icontasks/windowtaskitem.cpp b/applets/icontasks/windowtaskitem.cpp
index 970c19f..61b39ef 100644
--- a/applets/icontasks/windowtaskitem.cpp
+++ b/applets/icontasks/windowtaskitem.cpp
@@ -406,17 +406,18 @@ void WindowTaskItem::showContextMenu(const QPoint &pos, bool showAppMenu)
         actionList.append(configAction);
     }
 
-    TaskManager::BasicMenu menu(0, m_task.data(), &m_applet->groupManager(), actionList, showAppMenu ? getAppMenu() : QList <QAction*>());
-    menu.adjustSize();
+    TaskManager::BasicMenu * menu = new TaskManager::BasicMenu(0, m_task.data(), &m_applet->groupManager(), actionList, showAppMenu ? getAppMenu() : QList <QAction*>());
+    menu->adjustSize();
 
     if (m_applet->formFactor() != Plasma::Vertical) {
-        menu.setMinimumWidth(size().width());
+        menu->setMinimumWidth(size().width());
     }
 
     Q_ASSERT(m_applet->containment());
     Q_ASSERT(m_applet->containment()->corona());
     stopWindowHoverEffect();
-    menu.exec(pos.isNull() ? m_applet->containment()->corona()->popupPosition(this, menu.size()) : pos);
+    menu->exec(pos.isNull() ? m_applet->containment()->corona()->popupPosition(this, menu->size()) : pos);
+    menu->deleteLater();
     delete a;
 }