Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.0, 6.9.1
-
None
-
Windows 11, Qt 6.8.0/6.9.0 MSVC2022 x64
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.