<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - The xxxx_set_user_data() API cause client data corrupted in listener callbacks"
href="https://bugs.freedesktop.org/show_bug.cgi?id=100947">100947</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>The xxxx_set_user_data() API cause client data corrupted in listener callbacks
</td>
</tr>
<tr>
<th>Product</th>
<td>Wayland
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>trivial
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>wayland
</td>
</tr>
<tr>
<th>Assignee</th>
<td>wayland-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zhanggyb@163.com
</td>
</tr></table>
<p>
<div>
<pre>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: <a href="https://github.com/zhanggyb/set-user-data">https://github.com/zhanggyb/set-user-data</a>
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 <a href="https://github.com/zhanggyb/set-user-data">https://github.com/zhanggyb/set-user-data</a>
$ 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
<a href="https://github.com/zhanggyb/set-user-data/blob/master/surface.cpp">https://github.com/zhanggyb/set-user-data/blob/master/surface.cpp</a> and
<a href="https://github.com/zhanggyb/set-user-data/blob/master/output.cpp">https://github.com/zhanggyb/set-user-data/blob/master/output.cpp</a>
Uncomment these 2 lines can avoid assert error:
<a href="https://github.com/zhanggyb/set-user-data/blob/master/main.cpp:163">https://github.com/zhanggyb/set-user-data/blob/master/main.cpp:163</a>:
output.SetUserData(this);
<a href="https://github.com/zhanggyb/set-user-data/blob/master/main.cpp:164">https://github.com/zhanggyb/set-user-data/blob/master/main.cpp:164</a>:
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>