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

Multi window crash on close when using QGLWidget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.12.7
    • 5.12.3
    • GUI: OpenGL
    • None
    • macOS
    • 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:

      1. Open the application (2 QMainWindows are created).
      2. Click on the QGLWidget in the top window.
      3. Close the top window.
      4. 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.

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            tomhrabchak Tom Hrabchak
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes