From: Peng Huang Date: Tue, 2 Feb 2010 00:20:29 +0000 (+0800) Subject: Refine ibus_connection_open X-Git-Tag: 1.2.99.20100202~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4966dfdd9637dc1e18f00ae9b5e4248de863d56f;p=platform%2Fupstream%2Fibus.git Refine ibus_connection_open --- diff --git a/src/ibusconnection.c b/src/ibusconnection.c index 1a6f1879..21de213e 100644 --- a/src/ibusconnection.c +++ b/src/ibusconnection.c @@ -380,20 +380,17 @@ ibus_connection_open (const gchar *address) connection = g_hash_table_lookup (_connections, dbus_connection); - if (connection) { - dbus_connection_unref (dbus_connection); - g_object_ref (connection); - return connection; + if (connection == NULL) { + connection = ibus_connection_new (); + g_object_ref_sink (connection); + + ibus_connection_set_connection (connection, dbus_connection, TRUE); + g_hash_table_insert (_connections, dbus_connection, connection); + g_signal_connect (connection, "destroy", G_CALLBACK (_connection_destroy_cb), dbus_connection); } - connection = ibus_connection_new (); + dbus_connection_unref (dbus_connection); g_object_ref_sink (connection); - - ibus_connection_set_connection (connection, dbus_connection, TRUE); - g_hash_table_insert (_connections, dbus_connection, g_object_ref (connection)); - - g_signal_connect (connection, "destroy", G_CALLBACK (_connection_destroy_cb), dbus_connection); - return connection; }