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/kernel/qapplication.cpp | |
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/kernel/qapplication.cpp')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index aaf479f..5c333b0 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5791,10 +5791,12 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, #ifndef QT_NO_GESTURES QGestureManager* QGestureManager::instance() { - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - if (!qAppPriv->gestureManager) - qAppPriv->gestureManager = new QGestureManager(qApp); - return qAppPriv->gestureManager; + if (QApplicationPrivate *qAppPriv = QApplicationPrivate::instance()) { + if (!qAppPriv->gestureManager) + qAppPriv->gestureManager = new QGestureManager(qApp); + return qAppPriv->gestureManager; + } + return 0; } #endif // QT_NO_GESTURES |