diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-01-06 17:16:27 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-01-07 09:52:29 (GMT) |
commit | 828b1299e1ecb2da23799a2e49370e00dcf9c126 (patch) | |
tree | 6bbb15ada48bfbaf71f36c5c28e2d94c96d4b180 /src/gui/kernel/qapplication.cpp | |
parent | 089ee7094eabb2058b478f5d2f306a69f6c0b3bf (diff) | |
download | Qt-828b1299e1ecb2da23799a2e49370e00dcf9c126.zip Qt-828b1299e1ecb2da23799a2e49370e00dcf9c126.tar.gz Qt-828b1299e1ecb2da23799a2e49370e00dcf9c126.tar.bz2 |
Fixes a crash when destroying and creating QApplication.
Moved the gestureManager pointer to a QApplicationPrivate to make sure if
QApplication object is destroyed, QGestureManager pointer is set to zero.
Task-number: QTBUG-7029
Reviewed-by: Thiago
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 79fd3ad..12fe797 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -177,6 +177,7 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T directPainters = 0; #endif + gestureManager = 0; gestureWidget = 0; if (!self) @@ -3632,7 +3633,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } // walk through parents and check for gestures - if (qt_gestureManager) { + if (d->gestureManager) { switch (e->type()) { case QEvent::Paint: case QEvent::MetaCall: @@ -3664,13 +3665,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e) break; default: if (receiver->isWidgetType()) { - if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) + if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) return true; } else { // a special case for events that go to QGesture objects. // We pass the object to the gesture manager and it'll figure // out if it's QGesture or not. - if (qt_gestureManager->filterEvent(receiver, e)) + if (d->gestureManager->filterEvent(receiver, e)) return true; } } @@ -5678,6 +5679,14 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); } +QGestureManager* QGestureManager::instance() +{ + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); + if (!qAppPriv->gestureManager) + qAppPriv->gestureManager = new QGestureManager(qApp); + return qAppPriv->gestureManager; +} + QT_END_NAMESPACE #include "moc_qapplication.cpp" |