From bb6daf55c88addd58db914e62245b3e3296308b8 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 11 May 2010 08:49:23 +0200 Subject: Don't crash when applications set Qt::WA_TranslucentBackground. After replacing some code with a function call to s60UpdateIsOpaque() we introduced a crash for widgets that set Qt::WA_TranslucentBackground. The reason for the crash was that the Qt::WA_WState_Created attribute was being set before calling this function, but *not* before setWinId() was being called. This meant that s60UpdateIsOpaque() assumed that the window was created (and the handle added to the widget map), but this was not actually the case. The fix here is to move the call to s60UpdateIsOpaque() after the call to setWinId() such that those assumptions are true. Reviewed-by: Jani Hautakangas --- src/gui/kernel/qwidget_s60.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index a0429d3..02e7cb8 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -387,7 +387,6 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de | EPointerFilterMove | EPointerFilterDrag, 0); drawableWindow->EnableVisibilityChangeEvents(); - s60UpdateIsOpaque(); } q->setAttribute(Qt::WA_WState_Created); @@ -400,6 +399,9 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de // this generates a WinIdChanged event. setWinId(control.take()); + if (!desktop) + s60UpdateIsOpaque(); // must be called after setWinId() + } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget QScopedPointer control( q_check_ptr(new QSymbianControl(q)) ); -- cgit v0.12