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

Wayland window closing is unreliable



    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.12.2
    • Fix Version/s: 5.12.5
    • Component/s: QPA: Wayland
    • Labels:
    • Environment:
      Ubuntu 16.04
    • Platform/s:
    • Commits:
      85bb158ddf08aca4d76c13c6a9fcd2637d84d3ea 5d43a686fc3d5f13087a61e8ef216ecbbae0d15e


      Environment was: Desktop Ubuntu 16.04, Intel Corporation HD Graphics 530, Qt5.12.2 -  though different setups showed the same problem.

      To reproduce start the qwindow-compositor and the attached QML file as a Wayland client with:

      QT_WAYLAND_SHELL_INTEGRATION=xdg-shell qmlscene main.qml -platform wayland

      Click on the spinning rectangle to close the top-level client window. This should terminate the client process (qmlscene), like on X11. However, this is not reliable under Wayland. Observed the following  behaviours:

      1. Client process terminates gracefully (~40%)
      2. Client process terminates with a Wayland error (~40%):

      wl_display@1: error 0: invalid object 18
      The Wayland connection experienced a fatal error (Invalid argument)

      3. Client process crashes (< 5%):

      ASSERT: "window->wl_surface::isInitialized()" in file ../../../../hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp, line 148
      Aborted (core dumped)

      4. Client window is closed, but process keeps runninig (< 5%)
      Process is dead-locked:

      #0 __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
      #1 0x00007f468fef2dbd in __GI___pthread_mutex_lock (mutex=0x1d84678) at ../nptl/pthread_mutex_lock.c:80
      #2 0x00007f4689d7b6f2 in eglDestroySurface () from /usr/lib/x86_64-linux-gnu/mesa-egl/libEGL.so.1
      #3 0x00007f4692bbdcdc in QtWaylandClient::QWaylandEglWindow::invalidateSurface (this=0x1f22110) at ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp:176
      #4 0x00007f4692bbdf33 in QtWaylandClient::QWaylandEglWindow::setVisible (this=0x1f22110, visible=<optimized out>) at ../../../../hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp:170
      #5 0x00007f46919d7d6b in QWindowPrivate::setVisible (this=0x1ee4f20, visible=<optimized out>) at kernel/qwindow.cpp:402
      #6 0x00007f46919d0672 in QWindow::setVisible (this=this@entry=0x1f10ec0, visible=visible@entry=false) at kernel/qwindow.cpp:612
      #7 0x00007f46919d75e5 in QWindowPrivate::destroy (this=this@entry=0x1ee4f20) at kernel/qwindow.cpp:1889
      #8 0x00007f46919d776a in QWindow::destroy (this=<optimized out>) at kernel/qwindow.cpp:1857
      #9 0x00007f46919d811d in QWindow::event (this=this@entry=0x1f10ec0, ev=ev@entry=0x7ffdbf15e9d0) at kernel/qwindow.cpp:2305
      #10 0x00007f4692808044 in QQuickWindow::event (this=0x1f10ec0, e=0x7ffdbf15e9d0) at items/qquickwindow.cpp:1673
      #11 0x00007f4692006528 in QApplicationPrivate::notify_helper (this=this@entry=0x1d52270, receiver=receiver@entry=0x1f10ec0, e=e@entry=0x7ffdbf15e9d0) at kernel/qapplication.cpp:3736
      #12 0x00007f469200de0e in QApplication::notify (this=0x1d52250, receiver=0x1f10ec0, e=0x7ffdbf15e9d0) at kernel/qapplication.cpp:3093
      #13 0x00007f4690fdabf2 in QCoreApplication::notifyInternal2 (receiver=0x1f10ec0, event=0x7ffdbf15e9d0) at kernel/qcoreapplication.cpp:1060
      #14 0x00007f4690fdae50 in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=event@entry=0x7ffdbf15e9d0) at kernel/qcoreapplication.cpp:1462
      #15 0x00007f46919c919e in QGuiApplicationPrivate::processCloseEvent (e=0x1f4d010) at kernel/qguiapplication.cpp:2453
      #16 0x00007f46919cd08e in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x1f4d010) at kernel/qguiapplication.cpp:1879
      #17 0x00007f46919a47d1 in QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterface::SynchronousDelivery> (ev=ev@entry=0x1f4d010) at kernel/qwindowsysteminterface.cpp:105
      #18 0x00007f46919adc09 in QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery> (window=0x1f10ec0, accepted=accepted@entry=0x7ffdbf15eaa7) at kernel/qwindowsysteminterface.cpp:348
      #19 0x00007f46919bbbab in QPlatformWindow::close (this=<optimized out>) at kernel/qplatformwindow.cpp:352
      #20 0x00007f46919d2f58 in QWindow::close (this=<optimized out>) at kernel/qwindow.cpp:2156

      This is a stripped-down version of the actual problem which has been observed in the QtApplicationManager minidesk example, where behaviour 4 can be seen more often. That's also the behaviour, that leads to a different overall behaviour in the minidesk example and consequently should be avoided most urgently.


        1. crash.log
          3 kB
        2. freeze-5.12-prior-to-frame-callbacks.log
          220 kB
        3. main.qml
          0.5 kB

          Issue Links

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



              johanhelsing Johan Helsing
              bweimer Bernd Weimer
              0 Vote for this issue
              3 Start watching this issue



                  Gerrit Reviews

                  There are no open Gerrit changes