Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.12.3
-
None
-
-
3f23d27dd5b0589b3ea47faffd137e6d6ddeb805
Description
I see a crash when trying to close a window in a multi window application that uses a QGLWidget. See the attached zip for a simple project that reproduces this issue.
Reproduction steps:
- Open the application (2 QMainWindows are created).
- Click on the QGLWidget in the top window.
- Close the top window.
- Click in the remaining window. See crash.
I added basic debug output to show the focus window and the focus object. Something interesting to note is that after closing the first window, the Focus Window remains to be the previous window even though it has been closed.
Also, replacing QGLWidget with QOpenGLWidget does not reproduce this crash. When using QOpenGLWidget, after closing the first window the Focus Window properly becomes the remaining window (this is different from the original scenario).
int main(int argc, char *argv[]) { QApplication app(argc, argv); QApplication::connect(&app, &QGuiApplication::focusWindowChanged, [](QWindow* w) { qDebug() << "Focus Window Changed: " << w; }); QApplication::connect(&app, &QGuiApplication::focusObjectChanged, [](QObject* o) { qDebug() << "Focus Object Changed: " << o; }); auto w = new QMainWindow; w->setObjectName("Window1"); w->setCentralWidget(new QGLWidget); w->setAttribute(Qt::WA_DeleteOnClose); w->show(); auto w2 = new QMainWindow; w2->setObjectName("Window2"); w2->setCentralWidget(new QGLWidget); w2->setAttribute(Qt::WA_DeleteOnClose); w2->show(); return app.exec(); }
I am using macOS 10.13.6 using Qt 5.12.3. I believe this is a mac specific issue.