compositor: destroy all input binding objects on shutdown

wlsc_binding_destroy() was not being called at all. Fix the leaks by
introducing a function that destroys a whole list of bindings, instead
of individually saving an extra pointer to the binding object and
calling wlsc_binding_destroy() separately on each.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
Pekka Paalanen 2012-01-02 15:47:07 +02:00
parent cc9102edc5
commit 4738f3b1ea
3 changed files with 14 additions and 0 deletions

View File

@ -2022,6 +2022,8 @@ wlsc_compositor_shutdown(struct wlsc_compositor *ec)
/* Destroy all outputs associated with this compositor */
wl_list_for_each_safe(output, next, &ec->output_list, link)
output->destroy(output);
wlsc_binding_list_destroy_all(&ec->binding_list);
}
static int on_term_signal(int signal_number, void *data)

View File

@ -354,6 +354,9 @@ wlsc_compositor_add_binding(struct wlsc_compositor *compositor,
void
wlsc_binding_destroy(struct wlsc_binding *binding);
void
wlsc_binding_list_destroy_all(struct wl_list *list);
void
wlsc_compositor_run_binding(struct wlsc_compositor *compositor,
struct wlsc_input_device *device,

View File

@ -282,6 +282,15 @@ wlsc_binding_destroy(struct wlsc_binding *binding)
free(binding);
}
WL_EXPORT void
wlsc_binding_list_destroy_all(struct wl_list *list)
{
struct wlsc_binding *binding, *tmp;
wl_list_for_each_safe(binding, tmp, list, link)
wlsc_binding_destroy(binding);
}
WL_EXPORT void
wlsc_compositor_run_binding(struct wlsc_compositor *compositor,
struct wlsc_input_device *device,