[glib/wip/menus-rebase3] g_menu_model_get_item_link: be careful with refs
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/menus-rebase3] g_menu_model_get_item_link: be careful with refs
- Date: Mon, 28 Nov 2011 16:46:38 +0000 (UTC)
commit 166249d03ed1f8591845f9803bfe676e5ef4822e
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Nov 28 11:44:25 2011 -0500
g_menu_model_get_item_link: be careful with refs
Don't unref the hashtable until after we already take the ref on the
value that was contained in the hashtable, otherwise we may kill the
value.
gio/gmenumodel.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gio/gmenumodel.c b/gio/gmenumodel.c
index 4b6d4bc..79e73be 100644
--- a/gio/gmenumodel.c
+++ b/gio/gmenumodel.c
@@ -393,10 +393,13 @@ g_menu_model_real_get_item_link (GMenuModel *model,
else
g_assert_not_reached ();
+ if (value != NULL)
+ g_object_ref (value);
+
if (table != NULL)
g_hash_table_unref (table);
- return value ? g_object_ref (value) : NULL;
+ return value;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]