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

Segmentation fault when the exiting the opengl application running under platform eglfs

    XMLWordPrintable

Details

    • 8d45759432e7f954360b76ddeaf2b09acee8606e

    Description

      I try to run the opengl application without X Window System under platform eglfs and I have segmentation fault when the exiting from it. Then I run qopenglwindow from qtbase examples with the command

      ./qopenglwindow -platform eglfs.

      I have added following code to exit from this app by Escape into the function keyPressEvent:

      if (e->key() ==Qt::Key_Escape)

      close();

      And when I press Esc this application is falling down with segmentation fault! I have run this example under valgrind and I have seen the stack in the attached file stack_close.jpg. Thus the function QEglFSKmsIntegration::destroyNativeWindow (there gbm_surface_destroy is processed) is called before than QOpenGLContext::makeCurrent (and eglMakeCurrent). Therefore the surface pointer is deleted earlier than the working with it is finished.

      I have changed close() to qApp->quit() in function keyPressEvent, but the app has falling down too with stack in the attached file stack_quit.jpg. We can see the same as: the pointer is used after it has been deleted.

      Then I run the qopenglwidget example, but it is working rightly without segfault.

      I've debugged and I've seen that "delete d->platformWindow" is called from the function QWindow::destroy() (which is invoked from the QWindow destructor and from QWindow::closeEvent(QCloseEvent *)) and then the ~QSurface() is called, there QOpenGLContext::doneCurrent() is called. But the event QPlatformSurfaceEvent, that is sent before deleting platformWindow, isn't processed.

      I guess this is the problem. In my opinion the attached patch qt-platformSurfaceEvent.patch will solve this problem.

      Attachments

        1. qt-platformSurfaceEvent.patch
          3 kB
        2. stack_close.jpg
          stack_close.jpg
          2.74 MB
        3. stack_quit.jpg
          stack_quit.jpg
          2.55 MB
        For Gerrit Dashboard: QTBUG-52399
        # Subject Branch Project Status CR V

        Activity

          People

            lagocs Laszlo Agocs
            Elena Elena Zaretskaya
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes