Modify the duplicated commit events when the context_reset is called twice continuosly 80/161280/1
authorInHong Han <inhong1.han@samsung.com>
Wed, 22 Nov 2017 10:25:10 +0000 (19:25 +0900)
committerInHong Han <inhong1.han@samsung.com>
Wed, 22 Nov 2017 11:07:04 +0000 (11:07 +0000)
Change-Id: I938cc033a2eb680a44b441dd161309d17f44a26b

ism/extras/wayland_immodule/wayland_imcontext.c

index b7da7c1..0026552 100644 (file)
@@ -1264,11 +1264,15 @@ commit_preedit(WaylandIMContext *imcontext)
             ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
 
     if (commit_len > 0) {
+        char *commit_str = NULL;
+        commit_str = strdup(imcontext->preedit_commit);
+        clear_preedit(imcontext);
         ecore_imf_context_commit_event_add(imcontext->ctx,
-                imcontext->preedit_commit);
+                commit_str);
         ecore_imf_context_event_callback_call(imcontext->ctx,
                 ECORE_IMF_CALLBACK_COMMIT,
-                (void *)imcontext->preedit_commit);
+                (void *)commit_str);
+        free(commit_str);
     }
 }
 
@@ -2703,7 +2707,6 @@ wayland_im_context_reset(Ecore_IMF_Context *ctx)
     Eina_Bool preedit_empty = check_preedit_empty(imcontext);
 
     commit_preedit (imcontext);
-    clear_preedit(imcontext);
 
     if (!imcontext->input) return;