diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-29 11:44:04 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-29 12:12:44 (GMT) |
commit | 03baad51d584778a99f4b393232ccc1312db3391 (patch) | |
tree | 9ff318a63edd31614442afc1710ac93ca0826009 /src | |
parent | 4bd7e6930fcd9e04696aa5426691cd90ba383a32 (diff) | |
download | Qt-03baad51d584778a99f4b393232ccc1312db3391.zip Qt-03baad51d584778a99f4b393232ccc1312db3391.tar.gz Qt-03baad51d584778a99f4b393232ccc1312db3391.tar.bz2 |
Fixes crash when widget with WA_StaticContents child become toplevel.
Happens for example if a DockWidget is undocked and has a child
whith the WA_StaticContents attribute.
The parent does not change (so newParent is false) but still, the
top level widget change. So staticWidget need to be moved to the
new backingstore.
Reviewed-by: Benjamin Poulain
Task-number: QTBUG-6883
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e551a1d..81f38ec 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -9774,13 +9774,12 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) } #endif - if (newParent) { - if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) { + if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) { + if (newParent) oldBs->removeDirtyWidget(this); - // Move the widget and all its static children from - // the old backing store to the new one. - oldBs->moveStaticWidgets(this); - } + // Move the widget and all its static children from + // the old backing store to the new one. + oldBs->moveStaticWidgets(this); } if ((QApplicationPrivate::app_compile_version < 0x040200 |