From kde-commits Fri Jan 09 01:16:58 2009 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Fri, 09 Jan 2009 01:16:58 +0000 To: kde-commits Subject: branches/KDE/4.2/kdelibs/plasma Message-Id: <1231463818.269283.15944.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123146382621995 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(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