From 29b012eb0f913eac724afcb4e1b14a6d71492ff6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 24 Apr 2018 15:03:36 +0200 Subject: [PATCH] Fix crash in QMainWindow::tabifyDockWidgets() The list of tab bars in QMainWindowLayout::animationFinished() is apparently modified by animations. Take a copy before iterating over it and showing the tab bars. Amends ba2221bd7314c42353cd7ab2895c043d06d837ac. Task-number: QTBUG-67916 Change-Id: Ib3a70eeac1f3b3f0dd7bd5d37aa6c34b92a55086 Reviewed-by: Edward Welbourne Reviewed-by: Anton Kudryavtsev Reviewed-by: Gabriel de Dietrich --- src/widgets/widgets/qmainwindowlayout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 0297172100..0082ce291e 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2251,7 +2251,8 @@ void QMainWindowLayout::animationFinished(QWidget *widget) #if QT_CONFIG(dockwidget) parentWidget()->update(layoutState.dockAreaLayout.separatorRegion()); #if QT_CONFIG(tabbar) - for (QTabBar *tab_bar : qAsConst(usedTabBars)) + const auto usedTabBarsCopy = usedTabBars; // list potentially modified by animations + for (QTabBar *tab_bar : usedTabBarsCopy) tab_bar->show(); #endif // QT_CONFIG(tabbar) #endif // QT_CONFIG(dockwidget)