don't crash when given a null item pointer

BUG:176410

svn path=/trunk/KDE/kdelibs/; revision=891032
This commit is contained in:
Aaron J. Seigo 2008-12-01 00:49:36 +00:00
parent c4d63ac944
commit 2048022183
2 changed files with 5 additions and 5 deletions

View File

@ -69,7 +69,7 @@ Direction locationToDirection(Location location)
QGraphicsView *viewFor(const QGraphicsItem *item) QGraphicsView *viewFor(const QGraphicsItem *item)
{ {
if (!item->scene()) { if (!item || !item->scene()) {
return 0; return 0;
} }

View File

@ -166,9 +166,9 @@ void ToolTipManager::hide(QGraphicsWidget *widget)
return; return;
} }
d->currentWidget = 0;
d->showTimer->stop(); // stop the timer to show the tooltip d->showTimer->stop(); // stop the timer to show the tooltip
d->delayedHide = false; d->delayedHide = false;
d->currentWidget = 0;
d->tipWidget->hide(); d->tipWidget->hide();
} }
@ -255,10 +255,10 @@ void ToolTipManagerPrivate::onWidgetDestroyed(QObject *object)
QGraphicsWidget *w = static_cast<QGraphicsWidget*>(object); QGraphicsWidget *w = static_cast<QGraphicsWidget*>(object);
if (currentWidget == w) { if (currentWidget == w) {
tipWidget->setContent(0, ToolTipContent());
tipWidget->hide();
currentWidget = 0; currentWidget = 0;
showTimer->stop(); // stop the timer to show the tooltip showTimer->stop(); // stop the timer to show the tooltip
tipWidget->setContent(0, ToolTipContent());
tipWidget->hide();
delayedHide = false; delayedHide = false;
} }
@ -277,8 +277,8 @@ void ToolTipManagerPrivate::resetShownState()
//One might have moused out and back in again //One might have moused out and back in again
delayedHide = false; delayedHide = false;
isShown = false; isShown = false;
tipWidget->hide();
currentWidget = 0; currentWidget = 0;
tipWidget->hide();
} }
} }
} }