clients: add global_remove handler stubs
All the clients here were missing the global_remove handler. Because window.c did not have it, weston-desktop-shell and weston-keyboard segfaulted on compositor exit, as they received some wl_registry.global_remove events. Add more or less stub global_remove handlers, so that clients do not crash on such events. Toytoolkit and all applications would need a lot more code to properly handle the global object removal. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
cc9acfc75e
commit
0eab05d2a7
@@ -128,8 +128,15 @@ handle_global(void *data, struct wl_registry *registry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
|
||||||
|
{
|
||||||
|
/* XXX: unimplemented */
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener registry_listener = {
|
static const struct wl_registry_listener registry_listener = {
|
||||||
handle_global
|
handle_global,
|
||||||
|
handle_global_remove
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct wl_buffer *
|
static struct wl_buffer *
|
||||||
|
|||||||
@@ -588,8 +588,15 @@ registry_handle_global(void *data, struct wl_registry *registry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
registry_handle_global_remove(void *data, struct wl_registry *registry,
|
||||||
|
uint32_t name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener registry_listener = {
|
static const struct wl_registry_listener registry_listener = {
|
||||||
registry_handle_global
|
registry_handle_global,
|
||||||
|
registry_handle_global_remove
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -322,8 +322,15 @@ registry_handle_global(void *data, struct wl_registry *registry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
registry_handle_global_remove(void *data, struct wl_registry *registry,
|
||||||
|
uint32_t name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener registry_listener = {
|
static const struct wl_registry_listener registry_listener = {
|
||||||
registry_handle_global
|
registry_handle_global,
|
||||||
|
registry_handle_global_remove
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct display *
|
static struct display *
|
||||||
|
|||||||
@@ -264,8 +264,14 @@ handle_global(void *data, struct wl_registry *registry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener registry_listener = {
|
static const struct wl_registry_listener registry_listener = {
|
||||||
handle_global
|
handle_global,
|
||||||
|
handle_global_remove
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct touch *
|
static struct touch *
|
||||||
|
|||||||
@@ -387,8 +387,14 @@ global_handler(void *data, struct wl_registry *registry, uint32_t id,
|
|||||||
add_global_info(info, id, interface, version);
|
add_global_info(info, id, interface, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
global_remove_handler(void *data, struct wl_registry *registry, uint32_t name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener registry_listener = {
|
static const struct wl_registry_listener registry_listener = {
|
||||||
global_handler
|
global_handler,
|
||||||
|
global_remove_handler
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -300,8 +300,15 @@ registry_handle_global(void *data, struct wl_registry *registry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
registry_handle_global_remove(void *data, struct wl_registry *registry,
|
||||||
|
uint32_t name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener registry_listener = {
|
static const struct wl_registry_listener registry_listener = {
|
||||||
registry_handle_global
|
registry_handle_global,
|
||||||
|
registry_handle_global_remove
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
+23
-1
@@ -4079,6 +4079,27 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
|
|||||||
d->global_handler(d, id, interface, version, d->user_data);
|
d->global_handler(d, id, interface, version, d->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
registry_handle_global_remove(void *data, struct wl_registry *registry,
|
||||||
|
uint32_t name)
|
||||||
|
{
|
||||||
|
struct display *d = data;
|
||||||
|
struct global *global;
|
||||||
|
struct global *tmp;
|
||||||
|
|
||||||
|
wl_list_for_each_safe(global, tmp, &d->global_list, link) {
|
||||||
|
if (global->name != name)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* XXX: Should destroy bound globals, and call
|
||||||
|
* the counterpart of display::global_handler
|
||||||
|
*/
|
||||||
|
wl_list_remove(&global->link);
|
||||||
|
free(global->interface);
|
||||||
|
free(global);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
display_bind(struct display *display, uint32_t name,
|
display_bind(struct display *display, uint32_t name,
|
||||||
const struct wl_interface *interface, uint32_t version)
|
const struct wl_interface *interface, uint32_t version)
|
||||||
@@ -4087,7 +4108,8 @@ display_bind(struct display *display, uint32_t name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener registry_listener = {
|
static const struct wl_registry_listener registry_listener = {
|
||||||
registry_handle_global
|
registry_handle_global,
|
||||||
|
registry_handle_global_remove
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_CAIRO_EGL
|
#ifdef HAVE_CAIRO_EGL
|
||||||
|
|||||||
Reference in New Issue
Block a user