From 34f1758428282a327c12b0d8040061c1f67ecc7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 4 Feb 2010 11:35:27 +0100 Subject: Crash when closing any top-level widget on Symbian. The window surface must be deleted while the window is valid because on some graphics systems a notifcation is sent to the window when the surface is released. This fix is also an optmization as we no longer process any backing store requests while deleting the top-level. Previously it would handle requests from the window itself and all its children. Task-number: QT-2513 Reviewed-by: jbarron --- src/gui/kernel/qwidget.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4054d2a..4520a1b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1439,7 +1439,16 @@ QWidget::~QWidget() } #endif - if (QWidgetBackingStore *bs = d->maybeBackingStore()) { + if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) { + // Okay, we are about to destroy the top-level window that owns + // the backing store. Make sure we delete the backing store right away + // before the window handle is invalid. This is important because + // the backing store will delete its window surface, which may or may + // not have a reference to this widget that will be used later to + // notify the window it no longer has a surface. + delete d->extra->topextra->backingStore; + d->extra->topextra->backingStore = 0; + } else if (QWidgetBackingStore *bs = d->maybeBackingStore()) { bs->removeDirtyWidget(this); if (testAttribute(Qt::WA_StaticContents)) bs->removeStaticWidget(this); -- cgit v0.12