Commit f862722b authored by Simon Ser's avatar Simon Ser

server: add wl_global_set_user_data

When implementing a workaround for [1], one needs to accept a global to be
bound even though it has become stale.

Often, a global's user data is free'd when the global needs to be destroyed.
Being able to set the global's user data (e.g. to NULL) can help preventing a

(The laternative is to make the compositor responsible for keeping track of
stale user data objects via e.g. refcounting.)

[1]: wayland/wayland#10Signed-off-by: Simon Ser's avatarSimon Ser <>
parent 6908c8c8
Pipeline #50352 failed with stage
in 11 seconds
......@@ -279,6 +279,9 @@ wl_global_get_interface(const struct wl_global *global);
void *
wl_global_get_user_data(const struct wl_global *global);
wl_global_set_user_data(struct wl_global *global, void *data);
struct wl_client *
wl_client_create(struct wl_display *display, int fd);
......@@ -1239,6 +1239,19 @@ wl_global_get_user_data(const struct wl_global *global)
return global->data;
/** Set the global's user data
* \param global The global object
* \param data The user data pointer
* \since 1.17.90
wl_global_set_user_data(struct wl_global *global, void *data)
global->data = data;
/** Get the current serial number
* \param display The display object
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment