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>
dev
Pekka Paalanen 13 years ago
parent cc9102edc5
commit 4738f3b1ea
  1. 2
      compositor/compositor.c
  2. 3
      compositor/compositor.h
  3. 9
      compositor/util.c

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

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

@ -282,6 +282,15 @@ wlsc_binding_destroy(struct wlsc_binding *binding)
free(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 WL_EXPORT void
wlsc_compositor_run_binding(struct wlsc_compositor *compositor, wlsc_compositor_run_binding(struct wlsc_compositor *compositor,
struct wlsc_input_device *device, struct wlsc_input_device *device,

Loading…
Cancel
Save