[gnome-menus/wip/gobject-review] libmenu: Do not keep internal load_error in GMenuTree
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-menus/wip/gobject-review] libmenu: Do not keep internal load_error in GMenuTree
- Date: Thu, 21 Jul 2011 15:13:57 +0000 (UTC)
commit 540be2c7a1ee5f69e4ffe0c3a99e0d46b276f67c
Author: Vincent Untz <vuntz gnome org>
Date: Thu Jul 21 16:55:57 2011 +0200
libmenu: Do not keep internal load_error in GMenuTree
This is not used, and it actually gets corrupted at some point (since
g_propagate_error means we lose the ownership of the GError).
libmenu/gmenu-tree.c | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/libmenu/gmenu-tree.c b/libmenu/gmenu-tree.c
index 4ae51bd..76626a4 100644
--- a/libmenu/gmenu-tree.c
+++ b/libmenu/gmenu-tree.c
@@ -68,8 +68,6 @@ struct _GMenuTree
MenuLayoutNode *layout;
GMenuTreeDirectory *root;
- GError *load_error;
-
guint canonical : 1;
guint loaded : 1;
};
@@ -515,8 +513,6 @@ gmenu_tree_finalize (GObject *object)
g_free (tree->canonical_path);
tree->canonical_path = NULL;
- g_clear_error (&(tree->load_error));
-
G_OBJECT_CLASS (gmenu_tree_parent_class)->finalize (object);
}
@@ -607,18 +603,21 @@ gboolean
gmenu_tree_load_sync (GMenuTree *tree,
GError **error)
{
- if (!tree->loaded)
- {
- g_clear_error (&tree->load_error);
- gmenu_tree_build_from_layout (tree, &tree->load_error);
- tree->loaded = TRUE;
- }
+ GError *local_error = NULL;
- if (tree->load_error)
+ if (tree->loaded)
+ return TRUE;
+
+ gmenu_tree_build_from_layout (tree, &local_error);
+
+ if (local_error)
{
- g_propagate_error (error, tree->load_error);
+ g_propagate_error (error, local_error);
return FALSE;
}
+
+ tree->loaded = TRUE;
+
return TRUE;
}
@@ -4371,7 +4370,6 @@ gmenu_tree_force_rebuild (GMenuTree *tree)
{
gmenu_tree_item_unref (tree->root);
tree->root = NULL;
- g_clear_error (&tree->load_error);
tree->loaded = FALSE;
g_assert (tree->layout != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]