[Wayland-bugs] [Bug 100947] The xxxx_set_user_data() API cause client data corrupted in listener callbacks

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri May 5 12:52:41 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=100947

            Bug ID: 100947
           Summary: The xxxx_set_user_data() API cause client data
                    corrupted in listener callbacks
           Product: Wayland
           Version: unspecified
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: trivial
          Priority: medium
         Component: wayland
          Assignee: wayland-bugs at lists.freedesktop.org
          Reporter: zhanggyb at 163.com

Hello everyone.
I'm developing a simple C++ GUI toolkit based on wayland, and get stuck with a
weird problem recently.

I created a simple project with minimal code to reproduce this issue for
demonstration: https://github.com/zhanggyb/set-user-data

It's a CMake C++ project and use simple C++ structures to wrap wayland client
objects.

My test environment:

    Fedora 25
    Gnome 3.22.2
    wayland-devel-1.12.0-1.fc25.x86_64
    libwayland-client-1.12.0-1.fc25.x86_64

Checkout, build and run:

    $ git clone https://github.com/zhanggyb/set-user-data
    $ mkdir build
    $ cd build/
    $ cmake ..
    $ ./demo

Expected result:

    display a rectangle surface on desktop

Actual result:

    assert error will be raised, and the const member variables around wayland
object will be changed in the wl_output or wl_surface listener callbacks, see
https://github.com/zhanggyb/set-user-data/blob/master/surface.cpp and
https://github.com/zhanggyb/set-user-data/blob/master/output.cpp

    Uncomment these 2 lines can avoid assert error:

    https://github.com/zhanggyb/set-user-data/blob/master/main.cpp:163:
output.SetUserData(this);
    https://github.com/zhanggyb/set-user-data/blob/master/main.cpp:164:
surface.SetUserData(this);

I don't know why this happens, it seems the compositor changes the data in
client, or did I use the xxxx_set_user_data() API in the wrong way?

Thanks in advance.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-bugs/attachments/20170505/3829cbc5/attachment.html>


More information about the wayland-bugs mailing list