ecore_wl_input: Fix memory leaks 54/73854/2
authorJeongHyun Kang <jhyuni.kang@samsung.com>
Thu, 9 Jun 2016 22:35:05 +0000 (07:35 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Fri, 10 Jun 2016 03:41:40 +0000 (20:41 -0700)
Change-Id: Ideff36a5923afb7d7df68573c46f85b8b159a880

src/lib/ecore_wayland/ecore_wl_input.c

index 86d584da015b24c7cb3658f88475d7adf5f2c121..d25995c0f5384b049a473a71a85396cf813744dc 100644 (file)
@@ -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));