diff options
author | Gareth Stockwell <gareth.stockwell@sosco.com> | 2009-10-14 12:18:18 (GMT) |
---|---|---|
committer | Gareth Stockwell <gareth.stockwell@sosco.com> | 2009-10-15 08:50:58 (GMT) |
commit | 6c694eaae2b40be57c3292f43e085893095d9722 (patch) | |
tree | d40dd51a95a181d139af161c348f14d07201bf8b /src/gui/kernel/qwidget_s60.cpp | |
parent | b7142463c738cc1a0540fe456002fe94e7f5a894 (diff) | |
download | Qt-6c694eaae2b40be57c3292f43e085893095d9722.zip Qt-6c694eaae2b40be57c3292f43e085893095d9722.tar.gz Qt-6c694eaae2b40be57c3292f43e085893095d9722.tar.bz2 |
When reparenting native widget, delayed deletion of Symbian control
until control returns to the event loop.
This is necessary because reparenting can be triggered from the context
of a control's event handler. If reparenting causes that control to be
deleted, a crash can result.
Task-number: QTBUG-4664
Reviewed-by: axis
Diffstat (limited to 'src/gui/kernel/qwidget_s60.cpp')
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5527cc8..c3686b3 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -56,6 +56,12 @@ #include <aknappui.h> #endif +// This is necessary in order to be able to perform delayed invokation on slots +// which take arguments of type WId. One example is +// QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of +// CCoeControl objects until after the CONE event handler has finished running. +Q_DECLARE_METATYPE(WId) + QT_BEGIN_NAMESPACE extern bool qt_nograb(); @@ -438,7 +444,12 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de if (destroyw) { destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw); - CBase::Delete(destroyw); + + // Delay deletion of the control in case this function is called in the + // context of a CONE event handler such as + // CCoeControl::ProcessPointerEventL + QMetaObject::invokeMethod(q, "_q_delayedDestroy", + Qt::QueuedConnection, Q_ARG(WId, destroyw)); } if (q->testAttribute(Qt::WA_AcceptTouchEvents)) |