From 50ff2f4dbe0a5af6c7bf18c72dd7cf49eb39ee32 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 12 Oct 2009 13:25:36 +0300 Subject: Fix for qapplication::testDeleteLaterProcessEvents autotest in Symbian. Deleting qt_desktopWidget eventually ends up to QSymbianControl destructor. Calling setFocusSafely from QSymbianControl destructor causes a new events to be posted to event queue. Posting events tries to wakeup event dispatcher, which was deleted in QApplication destructor before calling delete for qt_desktopWidget. This makes application to panic. The fix is to change is_app_closing and is_app_running flags to correct state immediately after event dispatcher is closed down, and check the is_app_closing flag in QSymbianControl destructor. The change fixes panic in qapplication::testDeleteLaterProcessEvents, and otherwise QApplication and QWidget autotest results are same as before change. Reviewed-by: Miikka Heikkinen Reviewed-by: Brad --- src/gui/kernel/qapplication.cpp | 6 +++--- src/gui/kernel/qapplication_s60.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index afc6f63..bfccd41 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -943,7 +943,7 @@ void QApplicationPrivate::initialize() graphics_system = QGraphicsSystemFactory::create(graphics_system_name); #endif #ifndef QT_NO_WHEELEVENT -#ifdef Q_OS_MAC +#ifdef Q_OS_MAC QApplicationPrivate::wheel_scroll_lines = 1; #else QApplicationPrivate::wheel_scroll_lines = 3; @@ -1034,11 +1034,11 @@ QApplication::~QApplication() d->eventDispatcher->closingDown(); d->eventDispatcher = 0; + QApplicationPrivate::is_app_closing = true; + QApplicationPrivate::is_app_running = false; delete qt_desktopWidget; qt_desktopWidget = 0; - QApplicationPrivate::is_app_closing = true; - QApplicationPrivate::is_app_running = false; #ifndef QT_NO_CLIPBOARD delete qt_clipboard; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index acd1041..6919292 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -352,7 +352,8 @@ QSymbianControl::~QSymbianControl() { if (S60->curWin == this) S60->curWin = 0; - setFocusSafely(false); + if (!QApplicationPrivate::is_app_closing) + setFocusSafely(false); S60->appUi()->RemoveFromStack(this); delete m_longTapDetector; } -- cgit v0.12