diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 869fc49c021..83626b251a7 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2733,8 +2733,9 @@ QMainWindowLayout::~QMainWindowLayout() #if QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget) // unusedTabBars contains unparented tab bars, which need to be removed manually. - // ~QMainWindowTabBar() removes the barĀ from unusedTabBars => call qDeleteAll() on a copy. - const auto bars = unusedTabBars; + // ~QMainWindowTabBar() attempts to remove the barĀ from unusedTabBars + // => move it out of the way first. + const auto bars = std::move(unusedTabBars); qDeleteAll(bars); #endif // QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget) }