[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui
From:       Clarence Dang <dang () kde ! org>
Date:       2006-07-21 5:46:49
Message-ID: 1153460809.403973.9910.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 564740 by dang:

You should not be able to interact with actions that are supposed to have been deleted in clear().

This fixes an inability to keep items in the KolourPaint "View / Zoom" menu selected.
KolourPaint was calling setItems() every time a zoom level was selected (evil, yes).  This called
clear().  KolourPaint then called setCurrentItem() and an apparently-deleted item was selected.

When the event loop was re-entered, the apparently-deleted items were really deleted, hence currentItem()
would now return -1.

Unfortunately, this will sometimes trigger an assertion in Qt.  Watch qt-copy for my next
0140-signalbug.diff commit.



 M  +9 -0      kselectaction.cpp  


--- trunk/KDE/kdelibs/kdeui/kselectaction.cpp #564739:564740
@@ -441,7 +441,16 @@
   // we need to delete the actions later since we may get a call to clear()
   // from a method called due to a triggered(...) signal
   foreach (QAction* action, d->m_actionGroup->actions())
+  {
+    // deleteLater() only removes us from the actions() list (among
+    // other things) on the next entry into the event loop.  Until then,
+    // e.g. action() and setCurrentItem() will be working on items
+    // that are supposed to have been deleted.  So detach the action to
+    // prevent this from happening.
+    removeAction (action);
+
     action->deleteLater();
+  }
 }
 
 void KSelectAction::removeAllActions( )
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic