summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Sato <yusukes@chromium.org>2010-09-17 22:26:50 +0900
committerYusuke Sato <yusukes@chromium.org>2010-09-20 19:54:18 +0900
commita0694521739f91666f663e5538f06462e49eef3f (patch)
treef970f4a1def00ccc5061e4c6a6ab5666b731e3e5
parent1396c4649255efb8c48abe39bf09ef7ffbbed7af (diff)
downloadibus-a0694521739f91666f663e5538f06462e49eef3f.tar.gz
Fix g_assertion failure in bus_ibus_impl_{load,save}_global_engine_name functions.
Add NULL checks to the functions so they don't abort with assertion failure even if the functions are called before the ibus configuration daemon gets ready. See http://code.google.com/p/chromium-os/issues/detail?id=6689#c27 for details.
-rw-r--r--bus/ibusimpl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 63e17353..bd29e1e9 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -1935,7 +1935,8 @@ bus_ibus_impl_load_global_engine_name_from_config (BusIBusImpl *ibus)
GValue value = { 0 };
gchar *global_engine_name = NULL;
- g_assert (IBUS_IS_CONFIG (ibus->config));
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
+ g_return_val_if_fail (IBUS_IS_CONFIG (ibus->config), NULL);
if (ibus_config_get_value (ibus->config, "general", "global_engine", &value) &&
G_VALUE_TYPE (&value) == G_TYPE_STRING) {
@@ -1949,7 +1950,8 @@ bus_ibus_impl_load_global_engine_name_from_config (BusIBusImpl *ibus)
static void
bus_ibus_impl_save_global_engine_name_to_config (BusIBusImpl *ibus)
{
- g_assert (IBUS_IS_CONFIG (ibus->config));
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
+ g_return_if_fail (IBUS_IS_CONFIG (ibus->config));
if (ibus->use_global_engine && ibus->global_engine) {
GValue value = { 0 };
@@ -1967,7 +1969,8 @@ bus_ibus_impl_load_global_previous_engine_name_from_config (BusIBusImpl *ibus)
GValue value = { 0 };
gchar *global_previous_engine_name = NULL;
- g_assert (IBUS_IS_CONFIG (ibus->config));
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
+ g_return_val_if_fail (IBUS_IS_CONFIG (ibus->config), NULL);
if (ibus_config_get_value (ibus->config, "general", "global_previous_engine", &value) &&
G_VALUE_TYPE (&value) == G_TYPE_STRING) {
@@ -1981,7 +1984,8 @@ bus_ibus_impl_load_global_previous_engine_name_from_config (BusIBusImpl *ibus)
static void
bus_ibus_impl_save_global_previous_engine_name_to_config (BusIBusImpl *ibus)
{
- g_assert (IBUS_IS_CONFIG (ibus->config));
+ g_assert (BUS_IS_IBUS_IMPL (ibus));
+ g_return_if_fail (IBUS_IS_CONFIG (ibus->config));
if (ibus->use_global_engine && ibus->global_previous_engine_name) {
GValue value = { 0 };