From 8ab5b30d8c7962cc3ef6f81cffc98ada26ddcc77 Mon Sep 17 00:00:00 2001 From: JeongHyun Kang Date: Fri, 10 Jun 2016 07:35:05 +0900 Subject: [PATCH] ecore_wl_input: Fix memory leaks Change-Id: Ideff36a5923afb7d7df68573c46f85b8b159a880 --- src/lib/ecore_wayland/ecore_wl_input.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/lib/ecore_wayland/ecore_wl_input.c b/src/lib/ecore_wayland/ecore_wl_input.c index 86d584d..d25995c 100644 --- a/src/lib/ecore_wayland/ecore_wl_input.c +++ b/src/lib/ecore_wayland/ecore_wl_input.c @@ -562,6 +562,40 @@ _ecore_wl_input_del(Ecore_Wl_Input *input) if (input->cursor_surface) wl_surface_destroy(input->cursor_surface); + input->cursor_surface = NULL; + + if (input->pointer) + { +#ifdef WL_POINTER_RELEASE_SINCE_VERSION + if (input->seat_version >= WL_POINTER_RELEASE_SINCE_VERSION) + wl_pointer_release(input->pointer); + else +#endif + wl_pointer_destroy(input->pointer); + input->pointer = NULL; + } + + if (input->keyboard) + { +#ifdef WL_KEYBOARD_RELEASE_SINCE_VERSION + if (input->seat_version >= WL_KEYBOARD_RELEASE_SINCE_VERSION) + wl_keyboard_release(input->keyboard); + else +#endif + wl_keyboard_destroy(input->keyboard); + input->keyboard = NULL; + } + + if (input->touch) + { +#ifdef WL_TOUCH_RELEASE_SINCE_VERSION + if (input->seat_version >= WL_TOUCH_RELEASE_SINCE_VERSION) + wl_touch_release(input->touch); + else +#endif + wl_touch_destroy(input->touch); + input->touch = NULL; + } _ecore_wl_disp->inputs = eina_inlist_remove (_ecore_wl_disp->inputs, EINA_INLIST_GET(input)); -- 2.7.4