diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-08-11 14:22:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-11 14:22:02 -0400 |
commit | 9f103ca71e798d9676e6bdc9c62ce8efdc9ad5d2 (patch) | |
tree | c207b96c6f1c9eb8786349423a630a9fddc5e7cc /examples | |
parent | 62d8b252c093b3bd71362b1c76cb70b16a6cd63a (diff) | |
parent | 1c7dd71208169248e7fe9c7d86cce13955497017 (diff) |
Merge pull request #66 from martinetd/leak_plumbing
Leak plumbing
Diffstat (limited to 'examples')
-rw-r--r-- | examples/shared.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/shared.c b/examples/shared.c index cebdb785..6efa1bef 100644 --- a/examples/shared.c +++ b/examples/shared.c @@ -313,6 +313,7 @@ static void keyboard_remove(struct wlr_input_device *device, struct compositor_s } wl_list_remove(&kbstate->link); wl_list_remove(&kbstate->key.link); + free(kbstate); } static void pointer_remove(struct wlr_input_device *device, struct compositor_state *state) { @@ -331,6 +332,7 @@ static void pointer_remove(struct wlr_input_device *device, struct compositor_st wl_list_remove(&pstate->motion_absolute.link); wl_list_remove(&pstate->button.link); wl_list_remove(&pstate->axis.link); + free(pstate); } static void touch_remove(struct wlr_input_device *device, struct compositor_state *state) { @@ -349,6 +351,7 @@ static void touch_remove(struct wlr_input_device *device, struct compositor_stat wl_list_remove(&tstate->motion.link); wl_list_remove(&tstate->up.link); wl_list_remove(&tstate->cancel.link); + free(tstate); } static void tablet_tool_remove(struct wlr_input_device *device, struct compositor_state *state) { @@ -367,8 +370,25 @@ static void tablet_tool_remove(struct wlr_input_device *device, struct composito wl_list_remove(&tstate->proximity.link); //wl_list_remove(&tstate->tip.link); wl_list_remove(&tstate->button.link); + free(tstate); } +static void tablet_pad_remove(struct wlr_input_device *device, struct compositor_state *state) { + struct tablet_pad_state *pstate = NULL, *_pstate; + wl_list_for_each(_pstate, &state->tablet_pads, link) { + if (_pstate->device ==device) { + pstate = _pstate; + break; + } + } + if (!pstate) { + return; + } + // TODO probably missing more actions + free(pstate); +} + +// TODO missing something that calls this on teardown static void input_remove_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct compositor_state *state = wl_container_of(listener, state, input_add); @@ -385,6 +405,9 @@ static void input_remove_notify(struct wl_listener *listener, void *data) { case WLR_INPUT_DEVICE_TABLET_TOOL: tablet_tool_remove(device, state); break; + case WLR_INPUT_DEVICE_TABLET_PAD: + tablet_pad_remove(device, state); + break; default: break; } @@ -444,6 +467,7 @@ static void output_remove_notify(struct wl_listener *listener, void *data) { } wl_list_remove(&ostate->link); wl_list_remove(&ostate->frame.link); + free(ostate); } void compositor_init(struct compositor_state *state) { |