Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-105719

[Reg 6.2.3 -> 6.2.4] Resizing QTableView header freezes application when using event loop from QMfcApp::pluginInstance()

    XMLWordPrintable

Details

    • Windows

    Description

      Example Code

      #include <qmfcapp.h>
      #include <windows.h>
      #include <QTableView>
      #include <QFileSystemModel>
      
      BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/ )
      {
          static bool ownApplication = FALSE;
      
          if ( dwReason == DLL_PROCESS_ATTACH )
              ownApplication = QMfcApp::pluginInstance( hInstance );
          if ( dwReason == DLL_PROCESS_DETACH && ownApplication )
              delete qApp;
      
          return TRUE;
      }
      
      extern "C" __declspec(dllexport) bool showDialog( HWND parent )
      {
          Q_UNUSED(parent)
          auto model = new QFileSystemModel;
          model->setRootPath("C:/");
      
          auto tableView = new QTableView;
          tableView->setModel(model);
      
          tableView->setWindowTitle("Freezing Header Example");
          tableView->resize(640, 480);
          tableView->show();
      
          return TRUE;
      }
      

       

      Steps to reproduce

      1. Check out https://codereview.qt-project.org/c/qt-solutions/qt-solutions/+/427169 to enable Qt 6 builds
      2. Replace qtwinmigrate/examples/qtdll/main.cpp [1] with the example above (e.g. by applying qtbug-105719-example.diff)
      3. Build qtwinmigrate and its examples with Qt 6.2.4 or newer (cd qtwinmigrate && configure.bat && qmake && nmake)
      4. Run windeployqt.exe on qtwinmigrate/examples/qtdll/release/qtdialog.dll
      5. Open qtwinmigrate/examples/mfc/step1/QtMfc.dsp [2] in Visual Studio and build it
      6. Move QtMfc.exe to qtwinmigrate/examples/qtdll/release/ and run it
      7. Click "Help" > "About QtMfc..." to launch the QTableView
      8. Keep resizing the column header

      After doing the final step for a short while, the application will hang and one CPU core will run at 100% (see attached animation)

      [1] https://github.com/qtproject/qt-solutions/tree/master/qtwinmigrate/examples/qtdll
      [2] https://github.com/qtproject/qt-solutions/tree/master/qtwinmigrate/examples/mfc/step1

       

      Notes

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              skoh-qt Sze Howe Koh
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes