[SDL_Tizen] delete ecore_imf_callback 51/136251/1
authorhuiyu.eun <huiyu.eun@samsung.com>
Thu, 29 Jun 2017 00:53:23 +0000 (09:53 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Thu, 29 Jun 2017 00:55:44 +0000 (09:55 +0900)
-ecore_imf_context_event_callback_add(...) allocates memory
 which is released using ecore_imf_context_event_callback_del(...)
-Documentation :
https://docs.enlightenment.org/auto/group__Ecore__IMF__Context__Group.html#ga7e0ef28b49fbdc54c4657d88a139d5f5

Change-Id: I8be41c3b7426954b46d97377e902ba0b3e86a770
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/video/tizen/SDL_tizenkeyboard.c

index 39da3f8..801c923 100755 (executable)
@@ -79,10 +79,10 @@ void Tizen_InitKeyboard(_THIS)
 
     const char *default_id = ecore_imf_context_default_id_get();
     if (!default_id)
-      {
-         SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Can't create ecore_imf_context\n");
-         return;
-      }
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Can't create ecore_imf_context\n");
+        return;
+    }
 
     tizen_keyboard.imf_context = ecore_imf_context_add(default_id);
 
@@ -92,9 +92,7 @@ void Tizen_InitKeyboard(_THIS)
     ecore_imf_context_client_window_set(tizen_keyboard.imf_context, (void*)wind->id);
 
     ecore_imf_context_event_callback_add(tizen_keyboard.imf_context, ECORE_IMF_CALLBACK_COMMIT , _ecore_imf_event_commit_cb, NULL);
-
     ecore_imf_context_event_callback_add(tizen_keyboard.imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _ecore_imf_event_preedit_changed_cb, NULL);
-
     ecore_imf_context_input_panel_event_callback_add (tizen_keyboard.imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _ecore_imf_event_state_change_cb, NULL);
 
     ecore_imf_context_cursor_position_set(tizen_keyboard.imf_context, 0);
@@ -110,6 +108,10 @@ void Tizen_FiniKeyboard(void)
     if(tizen_keyboard.imf_context == NULL)
         return;
 
+    ecore_imf_context_event_callback_del(tizen_keyboard.imf_context, ECORE_IMF_CALLBACK_COMMIT, _ecore_imf_event_commit_cb);
+    ecore_imf_context_event_callback_del(tizen_keyboard.imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _ecore_imf_event_preedit_changed_cb);
+    ecore_imf_context_input_panel_event_callback_del(tizen_keyboard.imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _ecore_imf_event_preedit_changed_cb);
+
     ecore_imf_context_del(tizen_keyboard.imf_context);
     tizen_keyboard.imf_context = NULL;
 
@@ -137,7 +139,6 @@ Tizen_StartTextInput(_THIS)
     Tizen_ShowScreenKeyboard(_this, window);
 }
 
-
 void
 Tizen_StopTextInput(_THIS)
 {
@@ -152,14 +153,12 @@ void Tizen_SetTextInputRect(void)
 {
 }
 
-
 SDL_bool
 Tizen_HasScreenKeyboardSupport(_THIS)
 {
     return SDL_TRUE;
 }
 
-
 void
 Tizen_ShowScreenKeyboard(_THIS, SDL_Window * window)
 {