diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-07-27 08:23:44 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-07-27 08:32:29 (GMT) |
commit | 475a3c275ba173cb130a838b6053cb45d405887e (patch) | |
tree | 907d2e9c4717b9ad38b898d0885a6754d8146ee0 /src/gui/graphicsview | |
parent | 2b76b4fb7f91cc266a160420d12f0581cd87539a (diff) | |
download | Qt-475a3c275ba173cb130a838b6053cb45d405887e.zip Qt-475a3c275ba173cb130a838b6053cb45d405887e.tar.gz Qt-475a3c275ba173cb130a838b6053cb45d405887e.tar.bz2 |
Check the gesturemanager pointer before accessing it.
This fixes a crash when a static QWidget is destroyed after the QApplication
object.
Task-number: QTBUG-12025
Reviewed-by: Zeno Albisser
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 5fffefb..a2ae385 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1453,9 +1453,10 @@ QGraphicsItem::~QGraphicsItem() #ifndef QT_NO_GESTURES if (d_ptr->isObject && !d_ptr->gestureContext.isEmpty()) { QGraphicsObject *o = static_cast<QGraphicsObject *>(this); - QGestureManager *manager = QGestureManager::instance(); - foreach (Qt::GestureType type, d_ptr->gestureContext.keys()) - manager->cleanupCachedGestures(o, type); + if (QGestureManager *manager = QGestureManager::instance()) { + foreach (Qt::GestureType type, d_ptr->gestureContext.keys()) + manager->cleanupCachedGestures(o, type); + } } #endif |