From 2048022183025ea7e85a7109941fe1a41157df7b Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 1 Dec 2008 00:49:36 +0000 Subject: [PATCH] don't crash when given a null item pointer BUG:176410 svn path=/trunk/KDE/kdelibs/; revision=891032 --- plasma.cpp | 2 +- tooltipmanager.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plasma.cpp b/plasma.cpp index 943563dd7..e05a7f6ef 100644 --- a/plasma.cpp +++ b/plasma.cpp @@ -69,7 +69,7 @@ Direction locationToDirection(Location location) QGraphicsView *viewFor(const QGraphicsItem *item) { - if (!item->scene()) { + if (!item || !item->scene()) { return 0; } diff --git a/tooltipmanager.cpp b/tooltipmanager.cpp index 913b49c00..c2b4a88ed 100644 --- a/tooltipmanager.cpp +++ b/tooltipmanager.cpp @@ -166,9 +166,9 @@ void ToolTipManager::hide(QGraphicsWidget *widget) return; } + d->currentWidget = 0; d->showTimer->stop(); // stop the timer to show the tooltip d->delayedHide = false; - d->currentWidget = 0; d->tipWidget->hide(); } @@ -255,10 +255,10 @@ void ToolTipManagerPrivate::onWidgetDestroyed(QObject *object) QGraphicsWidget *w = static_cast(object); if (currentWidget == w) { - tipWidget->setContent(0, ToolTipContent()); - tipWidget->hide(); currentWidget = 0; showTimer->stop(); // stop the timer to show the tooltip + tipWidget->setContent(0, ToolTipContent()); + tipWidget->hide(); delayedHide = false; } @@ -277,8 +277,8 @@ void ToolTipManagerPrivate::resetShownState() //One might have moused out and back in again delayedHide = false; isShown = false; - tipWidget->hide(); currentWidget = 0; + tipWidget->hide(); } } }