[glib/wip/menus: 27/61] GMenuModel: fix bug in iters
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/menus: 27/61] GMenuModel: fix bug in iters
- Date: Thu, 17 Nov 2011 23:36:58 +0000 (UTC)
commit c5cd687bde962572e891e3c5f67cc5c4ca95102c
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Aug 25 00:50:02 2011 -0400
GMenuModel: fix bug in iters
gio/gmenumodel.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/gio/gmenumodel.c b/gio/gmenumodel.c
index 4391135..e389e8d 100644
--- a/gio/gmenumodel.c
+++ b/gio/gmenumodel.c
@@ -772,11 +772,14 @@ g_menu_attribute_iter_get_next (GMenuAttributeIter *iter,
iter->priv->valid = G_MENU_ATTRIBUTE_ITER_GET_CLASS (iter)
->get_next (iter, &iter->priv->name, &iter->priv->value);
- if (name)
- *name = iter->priv->name;
+ if (iter->priv->valid)
+ {
+ if (name)
+ *name = iter->priv->name;
- if (value)
- *value = g_variant_ref (iter->priv->value);
+ if (value)
+ *value = g_variant_ref (iter->priv->value);
+ }
return iter->priv->valid;
}
@@ -914,11 +917,14 @@ g_menu_link_iter_get_next (GMenuLinkIter *iter,
iter->priv->valid = G_MENU_LINK_ITER_GET_CLASS (iter)
->get_next (iter, &iter->priv->name, &iter->priv->value);
- if (name)
- *name = iter->priv->name;
+ if (iter->priv->valid)
+ {
+ if (name)
+ *name = iter->priv->name;
- if (value)
- *value = g_object_ref (iter->priv->value);
+ if (value)
+ *value = g_object_ref (iter->priv->value);
+ }
return iter->priv->valid;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]