Blob Blame History Raw
From fbdd157b2ab1e6e873818132530dd9e55e4f94dd Mon Sep 17 00:00:00 2001
From: Peng Huang <shawn.p.huang@gmail.com>
Date: Mon, 7 Mar 2011 10:26:04 -0500
Subject: [PATCH] Move gtk_key_snooper_remove from function object_fini to class_fini.

BUG=http://crosbug.com/12803
TEST=Linux desktop

Review URL: http://codereview.appspot.com/4267044
---
 client/gtk2/ibusimcontext.c |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index a634d0e..31a415d 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -91,6 +91,7 @@ static GdkWindow *_input_window = NULL;
 
 /* functions prototype */
 static void     ibus_im_context_class_init  (IBusIMContextClass    *klass);
+static void     ibus_im_context_class_fini  (IBusIMContextClass    *class);
 static void     ibus_im_context_init        (GObject               *obj);
 static void     ibus_im_context_finalize    (GObject               *obj);
 static void     ibus_im_context_reset       (GtkIMContext          *context);
@@ -155,10 +156,10 @@ ibus_im_context_register_type (GTypeModu
 
     static const GTypeInfo ibus_im_context_info = {
         sizeof (IBusIMContextClass),
-        (GBaseInitFunc)        NULL,
-        (GBaseFinalizeFunc)     NULL,
+        (GBaseInitFunc)      NULL,
+        (GBaseFinalizeFunc)  NULL,
         (GClassInitFunc)     ibus_im_context_class_init,
-        NULL,            /* class finialize */
+        (GClassFinalizeFunc) ibus_im_context_class_fini,
         NULL,            /* class data */
         sizeof (IBusIMContext),
         0,
@@ -371,6 +372,16 @@ ibus_im_context_class_init     (IBusIMCo
 }
 
 static void
+ibus_im_context_class_fini (IBusIMContextClass *class)
+{
+    if (_key_snooper_id != 0) {
+        IDEBUG ("snooper is terminated.");
+        gtk_key_snooper_remove (_key_snooper_id);
+        _key_snooper_id = 0;
+    }
+}
+
+static void
 ibus_im_context_init (GObject *obj)
 {
     IDEBUG ("%s", __FUNCTION__);
-- 
1.7.4.1

From c0489ba017f298e51efe86bc7f5def1928389197 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 11 Mar 2011 15:53:53 +0900
Subject: [PATCH] Fix preedit_string = NULL in ibus-x11 _free_ic()

---
 client/x11/main.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/client/x11/main.c b/client/x11/main.c
index a2967cc..16104de 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -526,6 +526,7 @@ _free_ic (gpointer data, gpointer user_data)
     g_return_if_fail (x11ic != NULL);
 
     g_free (x11ic->preedit_string);
+    x11ic->preedit_string = NULL;
 
     if (x11ic->preedit_attrs) {
         g_object_unref (x11ic->preedit_attrs);
-- 
1.7.4.1