Make sure to own IBusBus reference in client.
This commit is contained in:
10
src/client.c
10
src/client.c
@ -631,7 +631,11 @@ eekboard_client_enable_ibus_focus (EekboardClient *client)
|
|||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
|
if (!client->ibus_bus) {
|
||||||
client->ibus_bus = ibus_bus_new ();
|
client->ibus_bus = ibus_bus_new ();
|
||||||
|
g_object_ref_sink (client->ibus_bus);
|
||||||
|
}
|
||||||
|
|
||||||
connection = ibus_bus_get_connection (client->ibus_bus);
|
connection = ibus_bus_get_connection (client->ibus_bus);
|
||||||
add_match_rule (connection,
|
add_match_rule (connection,
|
||||||
"type='method_call',"
|
"type='method_call',"
|
||||||
@ -657,9 +661,15 @@ eekboard_client_disable_ibus_focus (EekboardClient *client)
|
|||||||
|
|
||||||
client->follows_focus = FALSE;
|
client->follows_focus = FALSE;
|
||||||
|
|
||||||
|
if (client->ibus_bus) {
|
||||||
|
if (client->ibus_focus_message_filter != 0) {
|
||||||
connection = ibus_bus_get_connection (client->ibus_bus);
|
connection = ibus_bus_get_connection (client->ibus_bus);
|
||||||
g_dbus_connection_remove_filter (connection,
|
g_dbus_connection_remove_filter (connection,
|
||||||
client->ibus_focus_message_filter);
|
client->ibus_focus_message_filter);
|
||||||
|
}
|
||||||
|
g_object_unref (client->ibus_bus);
|
||||||
|
client->ibus_bus = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ATSPI */
|
#endif /* HAVE_ATSPI */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user