From: Kristian Høgsberg Date: Mon, 8 Jul 2013 20:20:31 +0000 (-0400) Subject: input: Remove wl_seat global when a seat is destroyed X-Git-Tag: 1.1.91~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aaadc774a7a0cdb4b377d37608e554f470c67d57;p=platform%2Fupstream%2Fweston.git input: Remove wl_seat global when a seat is destroyed The input code was relying on compositor destruction to clean up the global, but that doesn't work when the global comes and goes dynamically. https://bugs.freedesktop.org/show_bug.cgi?id=65913 --- diff --git a/src/compositor.h b/src/compositor.h index 8070409..84f39e2 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -437,6 +437,7 @@ struct weston_keyboard { struct weston_seat { struct wl_list base_resource_list; + struct wl_global *global; struct weston_pointer *pointer; struct weston_keyboard *keyboard; struct weston_touch *touch; diff --git a/src/input.c b/src/input.c index a7a37e5..2519d9f 100644 --- a/src/input.c +++ b/src/input.c @@ -1531,8 +1531,9 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec, wl_list_init(&seat->drag_resource_list); wl_signal_init(&seat->destroy_signal); - wl_display_add_global(ec->wl_display, &wl_seat_interface, seat, - bind_seat); + seat->global = + wl_display_add_global(ec->wl_display, + &wl_seat_interface, seat, bind_seat); seat->compositor = ec; seat->modifier_state = 0; @@ -1550,7 +1551,6 @@ WL_EXPORT void weston_seat_release(struct weston_seat *seat) { wl_list_remove(&seat->link); - /* The global object is destroyed at wl_display_destroy() time. */ #ifdef ENABLE_XKBCOMMON if (seat->compositor->use_xkbcommon) { @@ -1569,5 +1569,7 @@ weston_seat_release(struct weston_seat *seat) free (seat->seat_name); + wl_display_remove_global(seat->compositor->wl_display, seat->global); + wl_signal_emit(&seat->destroy_signal, seat); }