ecore-wayland: plug some trivial leaks
authorMike Blumenkrantz <zmike@osg.samsung.com>
Tue, 20 Oct 2015 21:51:22 +0000 (17:51 -0400)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Tue, 20 Oct 2015 21:51:44 +0000 (17:51 -0400)
src/lib/ecore_wayland/ecore_wl.c
src/lib/ecore_wayland/ecore_wl_input.c

index 8d020cd..f6e7109 100644 (file)
@@ -554,6 +554,8 @@ _ecore_wl_shutdown(Eina_Bool close)
           wl_compositor_destroy(_ecore_wl_disp->wl.compositor);
         if (_ecore_wl_disp->wl.subcompositor)
           wl_subcompositor_destroy(_ecore_wl_disp->wl.subcompositor);
+        if (_ecore_wl_disp->cursor_theme)
+          wl_cursor_theme_destroy(_ecore_wl_disp->cursor_theme);
         if (_ecore_wl_disp->wl.display)
           {
              wl_registry_destroy(_ecore_wl_disp->wl.registry);
@@ -727,7 +729,7 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
 
         if (ewd->input)
           _ecore_wl_input_setup(ewd->input);
-        else
+        else if (!ewd->cursor_theme)
           {
              ewd->cursor_theme =
                wl_cursor_theme_load(NULL, ECORE_WL_DEFAULT_CURSOR_SIZE,
index 9bdd932..f189235 100644 (file)
@@ -224,6 +224,8 @@ ecore_wl_input_cursor_size_set(Ecore_Wl_Input *input, const int size)
 
    EINA_SAFETY_ON_NULL_RETURN(input->display->wl.shm);
 
+   if (input->display->cursor_theme)
+     wl_cursor_theme_destroy(input->display->cursor_theme);
    input->display->cursor_theme =
      wl_cursor_theme_load(NULL, input->cursor_size, input->display->wl.shm);
 }
@@ -239,6 +241,8 @@ ecore_wl_input_cursor_theme_name_set(Ecore_Wl_Input *input, const char *cursor_t
 
    EINA_SAFETY_ON_NULL_RETURN(input->display->wl.shm);
 
+   if (input->display->cursor_theme)
+     wl_cursor_theme_destroy(input->display->cursor_theme);
    input->display->cursor_theme =
      wl_cursor_theme_load(input->cursor_theme_name, input->cursor_size,
                           input->display->wl.shm);