Added the free callback function to prevent memory leak
authorInHong Han <inhong1.han@samsung.com>
Wed, 8 Mar 2017 12:50:19 +0000 (21:50 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 17 Mar 2017 10:36:25 +0000 (19:36 +0900)
Change-Id: Iedada3ed40c91e0f4632f9a04a30fbeea989c161

ism/extras/wayland_immodule/wayland_imcontext.c

index c8102a4..fca7184 100644 (file)
@@ -890,6 +890,13 @@ _send_input_panel_hide_request(Ecore_IMF_Context *ctx)
     }
 }
 
+static void _conformant_area_free (void *data EINA_UNUSED, void *ev)
+{
+    Ecore_Wl_Event_Conformant_Change *e = ev;
+    free(e);
+    e = NULL;
+}
+
 static Eina_Rectangle _conformant_area_backup = { 0, 0, 0, 0 };
 static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx)
 {
@@ -929,7 +936,7 @@ static Eina_Bool reset_conformant_area(Ecore_IMF_Context *ctx)
             ev->win = ecore_wl_window_id_get(window);
             ev->part_type = 1;
             ev->state = 0;
-            ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL);
+            ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, _conformant_area_free, NULL);
         }
 
         _conformant_reset_started = EINA_TRUE;
@@ -974,7 +981,7 @@ static void restore_conformant_area(Ecore_IMF_Context *ctx)
             ev->win = ecore_wl_window_id_get(window);
             ev->part_type = 1;
             ev->state = 0;
-            ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL);
+            ecore_event_add(ECORE_WL_EVENT_CONFORMANT_CHANGE, ev, _conformant_area_free, NULL);
         }
         _conformant_reset_started = EINA_FALSE;
     }
@@ -1848,6 +1855,14 @@ text_input_modifiers_map(void                 *data,
 }
 
 static void
+_ecore_keyevent_free (void *data EINA_UNUSED, void *ev)
+{
+    Ecore_Event_Key *e = ev;
+    free(e);
+    e = NULL;
+}
+
+static void
 text_input_keysym(void                 *data,
                   struct wl_text_input *text_input EINA_UNUSED,
                   uint32_t              serial EINA_UNUSED,
@@ -1919,9 +1934,9 @@ text_input_keysym(void                 *data,
     }
     else {
         if (state)
-            ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
+            ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_keyevent_free, NULL);
         else
-            ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL);
+            ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_keyevent_free, NULL);
     }
 }