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

Crash when pointer reaches a custom wayland surface from Qt's wl_display

    XMLWordPrintable

Details

    • Linux/Wayland
    • 3eea45e31ef796ab6f1363f8fd2882c151becc20 (qt/qtwayland/dev) 86b0d64b6c44fd8c3c3dd133bf52239f5520e524 (qt/qtwayland/5.12)

    Description

      Hi,

      When creating a custom wayland surface, by getting a wl_compositor and calling wl_compositor_create_surface, it's userdata is not filled with what Qt expects.

      Thus, as there is no check of ownership, when the pointer enters a non-Qt wl_surface running on the same wayland client connection, Qt tries to cast the userdata and it results in a segfault.

      Here is the relevant code in src/client/qwaylandinputdevice.cpp:447

      void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surface *surface,
                                                        wl_fixed_t sx, wl_fixed_t sy)
       {
           if (!surface)
               return;
       
           QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface);
           mFocus = window;
           mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy));
           mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); 

      I haven't tested many QtWayland version but I believe It should happens in every QtWayland versions.

      Maybe something derived from this can be done to fix this issue?

      https://github.com/alexandre-janniaux/qtwayland/pull/1/files

      Stacktrace is attached: stacktrace_qt_pointer.md

       

       

      Attachments

        Issue Links

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

          Activity

            People

              johanhelsing Johan Helsing
              ajanni Alexandre Janniaux
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes