From d57bb19902f863fc6db07674f6bd8881b0886b39 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 20 Feb 2017 13:26:18 +0100 Subject: Fix crash while dropping a tabbed group into a single floating QDockWidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem was caused by commit 0feeb6f6d2cfaa964763ca1fcab65672812b4eef which fixed QTBUG-58036. It reparented widget that used to be skiped. In particular, floating widgets are skiped. But seting the parent of a floating widget docks it. And so as a result it would not be skiped anymore. This has two side effect: This breaks the animation (as the widget is docked too early; and cause crash when QDockWidgetGroupWindow get reparented as this breaks invariant that these are always floating. So restore the skip from before commit 0feeb6f6d2cfaa964763ca1fcab65672812b4eef, and explicitly set the parent in all cases when the animation finishes. Change-Id: I0e3e29ad22d6ffe4d62242d48a18dadb916fc14f Reviewed-by: Sérgio Martins --- src/widgets/widgets/qmainwindowlayout.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/widgets/widgets/qmainwindowlayout.cpp') diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 68ca571acf..0d9c42fdf0 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2195,10 +2195,8 @@ void QMainWindowLayout::animationFinished(QWidget *widget) } if (QDockWidget *dw = qobject_cast(widget)) { - if (currentHoveredFloat) { - dw->setParent(currentHoveredFloat); - dw->show(); - } + dw->setParent(currentHoveredFloat ? currentHoveredFloat.data() : parentWidget()); + dw->show(); dw->d_func()->plug(currentGapRect); } #endif -- cgit v1.2.3