summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2015-02-03 12:30:56 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2015-02-03 12:30:56 +0900
commite6c883269e00e2432109c639d696491034dde5d5 (patch)
treeb51e9ed4e3e17531dfd5068e7f20de9bdce6f1ed
parent38d3c5ccdfa53cb4028e1e03bb877494035cb5a8 (diff)
downloadibus-e6c883269e00e2432109c639d696491034dde5d5.tar.gz
Release registry observed_paths and components if they are broken
Registry caches might be broken in a disk. BUG=rhbz#1187956 TEST=src/libibus.so Review URL: https://codereview.appspot.com/200980043
-rw-r--r--src/ibusregistry.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/ibusregistry.c b/src/ibusregistry.c
index 2830a087..8e9ada94 100644
--- a/src/ibusregistry.c
+++ b/src/ibusregistry.c
@@ -1,9 +1,9 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* bus - The Input Bus
- * Copyright (C) 2013 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2015 Peng Huang <shawn.p.huang@gmail.com>
+ * Copyright (C) 2015 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -374,12 +374,26 @@ ibus_registry_check_modification (IBusRegistry *registry)
g_assert (IBUS_IS_REGISTRY (registry));
for (p = registry->priv->observed_paths; p != NULL; p = p->next) {
+ if (!IBUS_IS_OBSERVED_PATH (p->data)) {
+ g_warning ("The registry cache of observed_paths might be " \
+ "broken and have to generate the cache again.");
+ g_list_free_full (registry->priv->observed_paths, g_object_unref);
+ registry->priv->observed_paths = NULL;
+ return TRUE;
+ }
if (ibus_observed_path_check_modification (
(IBusObservedPath *) p->data))
return TRUE;
}
for (p = registry->priv->components; p != NULL; p = p->next) {
+ if (!IBUS_IS_COMPONENT (p->data)) {
+ g_warning ("The registry cache of components might be " \
+ "broken and have to generate the cache again.");
+ g_list_free_full (registry->priv->components, g_object_unref);
+ registry->priv->components = NULL;
+ return TRUE;
+ }
if (ibus_component_check_modification ((IBusComponent *) p->data))
return TRUE;
}