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

Debugging code involving native menus with breakpoints set in qwindowsmenu.cpp results in execution stopping elsewhere

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • Qt Creator 11.0.3
    • Debugger
    • Windows

      This was originally encountered with https://codereview.qt-project.org/c/qt/qtdeclarative/+/519962, but apparently it can be reproduced with this old widgets example I had lying around:

      #include <QtWidgets>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QMainWindow mainWindow;
      
          QWidget *centralWidget = new QWidget;
      
          auto layout = new QHBoxLayout(centralWidget);
          centralWidget->setLayout(layout);
      
          auto *buttonGroup = new QButtonGroup(centralWidget);
      
          auto *button1 = new QPushButton("Button 1", centralWidget);
          button1->setCheckable(true);
          buttonGroup->addButton(button1);
          layout->addWidget(button1);
      
          auto *button2 = new QPushButton("Button 2", centralWidget);
          button2->setCheckable(true);
          buttonGroup->addButton(button2);
          layout->addWidget(button2);
      
          auto *slider = new QSlider(centralWidget);
          layout->addWidget(slider);
      
          mainWindow.setCentralWidget(centralWidget);
      
          mainWindow.resize(400, 400);
          mainWindow.show();
      
          return app.exec();
      }
      

      I added a breakpoint to qtbase\src\plugins\platforms\windows\qwindowsmenu.cpp:783 and started debugging, and execution stopped here:

      1  NtMapViewOfSection                                                                                   ntdll                                0x7ff9be1af874 
      2  LdrControlFlowGuardEnforced                                                                          ntdll                                0x7ff9be13c4cc 
      3  LdrControlFlowGuardEnforced                                                                          ntdll                                0x7ff9be13c0ca 
      4  LdrControlFlowGuardEnforced                                                                          ntdll                                0x7ff9be13c254 
      5  RtlQueryPerformanceCounter                                                                           ntdll                                0x7ff9be12070f 
      6  RtlQueryPerformanceCounter                                                                           ntdll                                0x7ff9be1210f0 
      7  RtlQueryPerformanceCounter                                                                           ntdll                                0x7ff9be120ebf 
      8  RtlImageRvaToSection                                                                                 ntdll                                0x7ff9be1388d4 
      9  RtlUnicodeToCustomCPN                                                                                ntdll                                0x7ff9be128cac 
      10 LdrLoadDll                                                                                           ntdll                                0x7ff9be13a25a 
      11 LoadLibraryExW                                                                                       KERNELBASE                           0x7ff9bb6e6452 
      12 QLibraryPrivate::load_sys                                                                            qlibrary_win.cpp                63   0x7ff8b269a27e 
      13 QLibraryPrivate::load                                                                                qlibrary.cpp                    530  0x7ff8b268b9e2 
      14 QLibraryPrivate::loadPlugin                                                                          qlibrary.cpp                    582  0x7ff8b268bcfc 
      15 QLibraryPrivate::pluginInstance                                                                      qlibrary.cpp                    503  0x7ff8b268c362 
      16 QFactoryLoader::instance                                                                             qfactoryloader.cpp              374  0x7ff8b210ab86 
      17 qLoadPlugin<QPlatformIntegration,QPlatformIntegrationPlugin,QList<QString> const &,int &,char * * &> qfactoryloader_p.h              97   0x7ff8af7fbb33 
      18 QPlatformIntegrationFactory::create                                                                  qplatformintegrationfactory.cpp 24   0x7ff8af7fb587 
      19 init_platform                                                                                        qguiapplication.cpp             1249 0x7ff8af757946 
      20 QGuiApplicationPrivate::createPlatformIntegration                                                    qguiapplication.cpp             1533 0x7ff8af74cb37 
      21 QGuiApplicationPrivate::createEventDispatcher                                                        qguiapplication.cpp             1555 0x7ff8af74cd47 
      22 QCoreApplicationPrivate::init                                                                        qcoreapplication.cpp            906  0x7ff8b1fdf2c7 
      23 QGuiApplicationPrivate::init                                                                         qguiapplication.cpp             1582 0x7ff8af74b667 
      24 QGuiApplication::QGuiApplication                                                                     qguiapplication.cpp             644  0x7ff8af748065 
      25 main                                                                                                 main.cpp                        10   0x7ff79c57297a 
      26 qtEntryPoint                                                                                         qtentrypoint_win.cpp            50   0x7ff79c578197 
      27 WinMain                                                                                              qtentrypoint_win.cpp            60   0x7ff79c577f9e 
      28 invoke_main                                                                                          exe_common.inl                  107  0x7ff79c574aa2 
      29 __scrt_common_main_seh                                                                               exe_common.inl                  288  0x7ff79c57498e 
      30 __scrt_common_main                                                                                   exe_common.inl                  331  0x7ff79c57484e 
      31 WinMainCRTStartup                                                                                    exe_winmain.cpp                 17   0x7ff79c574b3e 
      32 BaseThreadInitThunk                                                                                  KERNEL32                             0x7ff9bcea257d 
      33 RtlUserThreadStart                                                                                   ntdll                                0x7ff9be16aa58                                                                                                                                              
      
      Qt Creator 11.0.3
      Based on Qt 6.4.3 (MSVC 2019, x86_64)
      
      Built on Sep 27 2023 06:38:22
      
      From revision 68359f96a9
      

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

            davschul David Schulz
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes