Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-25925

Exiting a Qt 6.2-based Qt Creator emits "QLayout::removeWidget: Cannot remove a null widget."

    XMLWordPrintable

Details

    • 6a142dfd95ab497c1fe247cd4289affa13444577 (qt-creator/qt-creator/5.0)

    Description

      When exiting, a Qt Creator, built against Qt 6.2 will emit:

      QLayout::removeWidget: Cannot remove a null widget.
      QLayout::removeWidget: Cannot remove a null widget.
      QLayout::removeWidget: Cannot remove a null widget.
      

      Setting a breakpoint on QLayout::removeWidget() and exiting Qt Creator results in this backtrace:

      000000c4`98afcbe0 00007ffd`362be722 Qt6Widgetsd!QLayout::removeWidget(class QWidget * widget = 0x00000000`00000000)+0x34 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\widgets\kernel\qlayout.cpp @ 1359]
      000000c4`98afcc80 00007ffd`364d9713 Core4!Core::Internal::FancyTabWidget::removeTab(int index = 0n3)+0x62 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\plugins\coreplugin\fancytabwidget.cpp @ 557]
      000000c4`98afccd0 00007ffd`363a4f57 Core4!Core::ModeManager::removeMode(class Core::IMode * mode = 0x000001da`69ab8780)+0xc3 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\plugins\coreplugin\modemanager.cpp @ 288]
      000000c4`98afcd30 00007ffd`2b470679 Core4!Core::IMode::~IMode(void)+0x37 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\plugins\coreplugin\imode.cpp @ 134]
      000000c4`98afcd60 00007ffd`2b47e5e4 Help4!Help::Internal::HelpMode::~HelpMode(void)+0x29
      000000c4`98afcd90 00007ffd`2b48026c Help4!Help::Internal::HelpPluginPrivate::~HelpPluginPrivate(void)+0xb4
      000000c4`98afcdc0 00007ffd`2b470800 Help4!Help::Internal::HelpPluginPrivate::`scalar deleting destructor'(void)+0x2c
      000000c4`98afcdf0 00007ffd`2b4188ec Help4!Help::Internal::HelpPlugin::~HelpPlugin(void)+0x60 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\plugins\help\helpplugin.cpp @ 171]
      000000c4`98afce50 00007ffd`53593cc7 Help4!Help::Internal::HelpPlugin::`scalar deleting destructor'(void)+0x2c
      000000c4`98afce80 00007ffd`5354a4e9 ExtensionSystem4!ExtensionSystem::Internal::PluginSpecPrivate::kill(void)+0x67 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\libs\extensionsystem\pluginspec.cpp @ 1124]
      000000c4`98afced0 00007ffd`53578d75 ExtensionSystem4!ExtensionSystem::Internal::PluginManagerPrivate::loadPlugin(class ExtensionSystem::PluginSpec * spec = 0x000001da`6273d7c0, ExtensionSystem::PluginSpec::State destState = Deleted (0n7))+0x1c9 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\libs\extensionsystem\pluginmanager.cpp @ 1608]
      000000c4`98afd180 00007ffd`5356a2da ExtensionSystem4!<lambda_b2b023513dedb8b75362dfb6834c29e3>::operator()(class ExtensionSystem::PluginSpec * spec = 0x000001da`6273d7c0)+0x45 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\libs\extensionsystem\pluginmanager.cpp @ 1063]
      000000c4`98afd1c0 00007ffd`5354deb9 ExtensionSystem4!Utils::reverseForeach<QList<ExtensionSystem::PluginSpec *>,<lambda_b2b023513dedb8b75362dfb6834c29e3> >(class QList<ExtensionSystem::PluginSpec *> * c = 0x000000c4`98afd258, class ExtensionSystem::Internal::PluginManagerPrivate::deleteAll::__l2::<lambda_b2b023513dedb8b75362dfb6834c29e3> * operation = 0x000000c4`98afd250)+0x7a [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\libs\utils\algorithm.h @ 1041]
      000000c4`98afd230 00007ffd`53549c83 ExtensionSystem4!ExtensionSystem::Internal::PluginManagerPrivate::deleteAll(void)+0x69 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\libs\extensionsystem\pluginmanager.cpp @ 1061]
      000000c4`98afd2a0 00007ffd`53547981 ExtensionSystem4!ExtensionSystem::Internal::PluginManagerPrivate::shutdown(void)+0x113 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\libs\extensionsystem\pluginmanager.cpp @ 1397]
      000000c4`98afd440 00007ff7`6ac728da ExtensionSystem4!ExtensionSystem::PluginManager::shutdown(void)+0x21 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\libs\extensionsystem\pluginmanager.cpp @ 410]
      000000c4`98afd470 00007ff7`6ac65257 qtcreator!QtPrivate::FunctorCall<QtPrivate::IndexesList<>,QtPrivate::List<>,void,void (<function> ** f = 0x000000c4`98afd4e0, void ** arg = 0x000000c4`98afd8c8)+0x2a [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\kernel\qobjectdefs_impl.h @ 146]
      000000c4`98afd4b0 00007ff7`6ac7516e qtcreator!QtPrivate::FunctionPointer<void (<function> * f = 0x00007ffd`53513c5b, void * __formal = 0x000000c4`98afddf8, void ** arg = 0x000000c4`98afd8c8)+0x37 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\kernel\qobjectdefs_impl.h @ 210]
      000000c4`98afd4e0 00007ffd`416666b7 qtcreator!QtPrivate::QStaticSlotObject<void (int which = 0n1, class QtPrivate::QSlotObjectBase * this_ = 0x000001da`6a25a130, class QObject * r = 0x000000c4`98afddf8, void ** a = 0x000000c4`98afd8c8, bool * ret = 0x00000000`00000000)+0x8e [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\kernel\qobject_impl.h @ 96]
      000000c4`98afd530 00007ffd`417182a7 Qt6Cored!QtPrivate::QSlotObjectBase::call(class QObject * r = 0x000000c4`98afddf8, void ** a = 0x000000c4`98afd8c8)+0x57 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\kernel\qobjectdefs_impl.h @ 375]
      000000c4`98afd580 00007ffd`4170047c Qt6Cored!doActivate<0>(class QObject * sender = 0x000000c4`98afdd00, int signal_index = 0n3, void ** argv = 0x000000c4`98afd8c8)+0x917 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\kernel\qobject.cpp @ 3867]
      000000c4`98afd860 00007ffd`41626da3 Qt6Cored!QMetaObject::activate(class QObject * sender = 0x000000c4`98afdd00, struct QMetaObject * m = 0x00007ffd`41e5a460, int local_signal_index = 0n0, void ** argv = 0x000000c4`98afd8c8)+0x7c [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\kernel\qobject.cpp @ 3928]
      000000c4`98afd8a0 00007ffd`4162a3d9 Qt6Cored!QCoreApplication::aboutToQuit(struct QCoreApplication::QPrivateSignal _t1 = struct QCoreApplication::QPrivateSignal)+0x53 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\Core_autogen\include\moc_qcoreapplication.cpp @ 253]
      000000c4`98afd900 00007ffd`416248a3 Qt6Cored!QCoreApplicationPrivate::execCleanup(void)+0x79 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\kernel\qcoreapplication.cpp @ 1397]
      000000c4`98afd940 00007ffd`43541409 Qt6Cored!QCoreApplication::exec(void)+0x1c3 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\corelib\kernel\qcoreapplication.cpp @ 1382]
      000000c4`98afda20 00007ffd`423614cb Qt6Guid!QGuiApplication::exec(void)+0x29 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\gui\kernel\qguiapplication.cpp @ 1875]
      000000c4`98afda50 00007ff7`6ac5b6a7 Qt6Widgetsd!QApplication::exec(void)+0x1b [C:\Users\alportal\dev\qt6_desktop\qtbase\src\widgets\kernel\qapplication.cpp @ 2611]
      000000c4`98afda80 00007ff7`6ac83fa0 qtcreator!main(int argc = 0n1, char ** argv = 0x000001da`5c19c1e0)+0x3d67 [C:\Users\alportal\dev\tqtc-qtc-super\qtcreator\src\app\main.cpp @ 821]
      000000c4`98aff740 00007ff7`6ac80f32 qtcreator!WinMain(struct HINSTANCE__ * __formal = 0x00007ff7`6ac50000, struct HINSTANCE__ * __formal = 0x00000000`00000000, char * __formal = 0x000001da`5c186c60 "", int __formal = 0n10)+0x110 [C:\Users\alportal\dev\qt6_desktop\qtbase\src\entrypoint\qtentrypoint_win.cpp @ 97]
      000000c4`98aff7d0 00007ff7`6ac80e1e qtcreator!invoke_main(void)+0x32 [d:\A01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 107]
      000000c4`98aff810 00007ff7`6ac80cde qtcreator!__scrt_common_main_seh(void)+0x12e [d:\A01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288]
      000000c4`98aff880 00007ff7`6ac80fce qtcreator!__scrt_common_main(void)+0xe [d:\A01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 331]
      000000c4`98aff8b0 00007ffd`a86e7034 qtcreator!WinMainCRTStartup(void * __formal = 0x000000c4`98952000)+0xe [d:\A01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_winmain.cpp @ 17]
      000000c4`98aff8e0 00007ffd`a9ca2651 KERNEL32!BaseThreadInitThunk+0x14
      000000c4`98aff910 00000000`00000000 ntdll!RtlUserThreadStart+0x21
      

      The call stack for the second printout:

      1 Core::Internal::FancyTabWidget::removeTab                                    fancytabwidget.cpp  557 0x7fffcc815a5b 
      2 Core::ModeManager::removeMode                                                modemanager.cpp     287 0x7fffcc9074f1 
      3 Core::IMode::~IMode                                                          imode.cpp           133 0x7fffcc87dbac 
      4 ProjectExplorer::ProjectsMode::~ProjectsMode                                 projectexplorer.cpp 361 0x7fffbfb84d0c 
      5 ProjectExplorer::ProjectExplorerPluginPrivate::~ProjectExplorerPluginPrivate projectexplorer.cpp 399 0x7fffbfb849ce 
      6 ProjectExplorer::ProjectExplorerPluginPrivate::~ProjectExplorerPluginPrivate projectexplorer.cpp 399 0x7fffbfb84bb6 
      7 ProjectExplorer::ProjectExplorerPlugin::~ProjectExplorerPlugin               projectexplorer.cpp 691 0x7fffbfb42572 
      8 ProjectExplorer::ProjectExplorerPlugin::~ProjectExplorerPlugin               projectexplorer.cpp 698 0x7fffbfb425b0 
      

      and for the third one:

      1 Core::Internal::FancyTabWidget::removeTab          fancytabwidget.cpp 557  0x7fffcc815a5b 
      2 Core::ModeManager::removeMode                      modemanager.cpp    287  0x7fffcc9074f1 
      3 Core::IMode::~IMode                                imode.cpp          133  0x7fffcc87dbac 
      4 Core::DesignMode::~DesignMode                      designmode.cpp     106  0x7fffcc73df7f 
      5 Core::DesignMode::~DesignMode                      designmode.cpp     106  0x7fffcc73df9a 
      6 Core::DesignMode::destroyModeIfRequired            designmode.cpp     234  0x7fffcc73e8bc 
      7 Core::Internal::CorePlugin::~CorePlugin            coreplugin.cpp     110  0x7fffcc7308eb 
      8 Core::Internal::CorePlugin::~CorePlugin            coreplugin.cpp     114  0x7fffcc730968 
      9 ExtensionSystem::Internal::PluginSpecPrivate::kill pluginspec.cpp     1124 0x7ffff7f8f183 
      

      Update: The issue was always there, however, after https://codereview.qt-project.org/c/qt/qtbase/+/346261 it started manifesting with a warning. The reason is that mode's widget is being deleted before the mode itself, so the list inside ModeManager (d->modes) and the list inside FancyTabWidget (m_modesStack) are getting out of sync. When the widget is being deleted, Qt notifies internally the stacked layout about the removal and it updates stacked layout's internal list. Later, when we call ModeManager::removeMode(), we are assuming that mode's widget is still inside the stacked layout, what is not true anymore.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jkobus Jarek Kobus
            portale Alessandro Portale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes