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

List:       kde-commits
Subject:    branches/KDE/4.2/kdelibs/plasma
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2009-01-09 1:16:58
Message-ID: 1231463818.269283.15944.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 907982 by aseigo:

clear the current widget when an widget is unregistered; solves a crash where the \
task widget disconnects *all* signals to items before deleting them, thus preventing \
the destroyed(QObject*) signal from getting through. it was calling unregisterWidget, \
but that wasn't clearing the current widget -> POOF! CCMAIL:faure@kde.org
CCBUG:179819


 M  +7 -4      tooltipmanager.cpp  


--- branches/KDE/4.2/kdelibs/plasma/tooltipmanager.cpp #907981:907982
@@ -80,9 +80,8 @@
       * called when a widget inside the tooltip manager is deleted
       */
     void onWidgetDestroyed(QObject * object);
-
+    void removeWidget(QGraphicsWidget *w);
     void clearTips();
-
     void doDelayedHide();
 
     QGraphicsWidget *currentWidget;
@@ -182,7 +181,6 @@
     //the tooltip is not registered we add it in our map of tooltips
     d->tooltips.insert(widget, ToolTipContent());
     widget->installEventFilter(this);
-    //connect to object destruction
     connect(widget, SIGNAL(destroyed(QObject*)), this, \
SLOT(onWidgetDestroyed(QObject*)));  }
 
@@ -193,7 +191,7 @@
     }
 
     widget->removeEventFilter(this);
-    d->tooltips.remove(widget);
+    d->removeWidget(widget);
 }
 
 void ToolTipManager::setContent(QGraphicsWidget *widget, const ToolTipContent &data)
@@ -262,7 +260,12 @@
     // NOTE: DO NOT USE THE w VARIABLE FOR ANYTHING OTHER THAN COMPARING
     //       THE ADDRESS! ACTUALLY USING THE OBJECT WILL RESULT IN A CRASH!!!
     QGraphicsWidget *w = static_cast<QGraphicsWidget*>(object);
+    removeWidget(w);
+}
 
+void ToolTipManagerPrivate::removeWidget(QGraphicsWidget *w)
+{
+    // DO NOTE ACCESS w HERE!! IT MAY BE IN THE PROCESS OF DELETION!
     if (currentWidget == w) {
         currentWidget = 0;
         showTimer->stop();  // stop the timer to show the tooltip


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

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