keyboard: free stuff on exit

This fixes a bunch of leaks when trying to run a Weston test with
desktop-shell, which spawns weston-keyboard.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago
parent 1f3e9045ad
commit d9b949d8b9
  1. 17
      clients/keyboard.c

@ -1011,6 +1011,20 @@ keyboard_create(struct virtual_keyboard *virtual_keyboard)
display_output_handler); display_output_handler);
} }
static void
keyboard_destroy(struct virtual_keyboard *virtual_keyboard)
{
if (virtual_keyboard->input_panel)
zwp_input_panel_v1_destroy(virtual_keyboard->input_panel);
if (virtual_keyboard->input_method)
zwp_input_method_v1_destroy(virtual_keyboard->input_method);
widget_destroy(virtual_keyboard->keyboard->widget);
window_destroy(virtual_keyboard->keyboard->window);
free(virtual_keyboard->keyboard);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -1037,5 +1051,8 @@ main(int argc, char *argv[])
display_run(virtual_keyboard.display); display_run(virtual_keyboard.display);
keyboard_destroy(&virtual_keyboard);
display_destroy(virtual_keyboard.display);
return 0; return 0;
} }

Loading…
Cancel
Save