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

Creating QOpenGlWidget in modal dialog causes a Assertion on dialog close

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.0, 6.9.1
    • GUI: OpenGL
    • None
    • Windows 11, Qt 6.8.0/6.9.0 MSVC2022 x64
    • Windows

    Description

      If a QOpenGlWidget is created in a modal QDialog while the dialog is modal, an assertion is made when the dialog is closed.

      // code placeholder
      ASSERT: "platformWindow" in file C:\Users\qt\work\qt\qtbase\src\plugins\platforms\windows\qwindowscontext.cpp, line 1256 

      In this case, QDialog::exec() returns when the QOpenGlWidget is created, even though the dialog is still displayed and can be used normally.

      However, if the QOpenGL widget is created in the QDialog before it becomes modal, everything works as expected. Even if a "dummy QOpenGL widget" is created in the QDialog's creator that isn't displayed, a QOpenGL widget can be created after the dialog is modal - and everything works fine here, too.

      In our case, it is necessary that we can add QOpenGL widgets in a modal QDialog at any time dynamically. In our application everything worked with Qt 5.7.0

      Attached is a test project that includes both cases. One dialog with an assertion and another with a "dummy QOpenGlWidget" that works. In this test application, you need to open the dialog using one of the two menu items and then open the QOpenGlWidget using the button in the dialog.

      Attachments

        1. TestProject-1.7z
          4 kB
          Dominik Schrott
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lagocs Laszlo Agocs
            schrotti Dominik Schrott
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes