[gtk+/gtk-2-22] Clarify memory management of tree models
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-22] Clarify memory management of tree models
- Date: Tue, 10 Aug 2010 03:19:41 +0000 (UTC)
commit a11e4a58c0281d10192fe109101394ec7f526431
Author: Christian Dywan <christian lanedo com>
Date: Mon Aug 9 21:35:26 2010 -0400
Clarify memory management of tree models
It helps to be explicit about these things.
Bug 609264.
(cherry picked from commit 2a12f74c8e8334d7b1f7629b99fd3e23f0f8a3af)
gtk/gtkliststore.c | 4 +++-
gtk/gtktreemodel.c | 4 +++-
gtk/gtktreestore.c | 4 +++-
3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c
index 61b314d..2aa4181 100644
--- a/gtk/gtkliststore.c
+++ b/gtk/gtkliststore.c
@@ -926,7 +926,9 @@ gtk_list_store_set_valist (GtkListStore *list_store,
* The list is terminated by a -1. For example, to set column 0 with type
* %G_TYPE_STRING to "Foo", you would write <literal>gtk_list_store_set (store, iter,
* 0, "Foo", -1)</literal>.
- * The value will be copied or referenced by the store if appropriate.
+ *
+ * The value will be referenced by the store if it is a %G_TYPE_OBJECT, and it
+ * will be copied if it is a %G_TYPE_STRING or %G_TYPE_BOXED.
**/
void
gtk_list_store_set (GtkListStore *list_store,
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c
index 84b0a81..32a4e6f 100644
--- a/gtk/gtktreemodel.c
+++ b/gtk/gtktreemodel.c
@@ -1416,8 +1416,10 @@ gtk_tree_model_unref_node (GtkTreeModel *tree_model,
* write: <literal>gtk_tree_model_get (model, iter, 0, &place_string_here, -1)</literal>,
* where <literal>place_string_here</literal> is a <type>gchar*</type> to be
* filled with the string.
- * If appropriate, the returned values have to be freed or unreferenced.
*
+ * Returned values with type %G_TYPE_OBJECT have to be unreferenced, values
+ * with type %G_TYPE_STRING or %G_TYPE_BOXED have to be freed. Other values are
+ * passed by value.
**/
void
gtk_tree_model_get (GtkTreeModel *tree_model,
diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c
index dd5dce0..1dd4e02 100644
--- a/gtk/gtktreestore.c
+++ b/gtk/gtktreestore.c
@@ -1073,7 +1073,9 @@ gtk_tree_store_set_valist (GtkTreeStore *tree_store,
* The list is terminated by a -1. For example, to set column 0 with type
* %G_TYPE_STRING to "Foo", you would write
* <literal>gtk_tree_store_set (store, iter, 0, "Foo", -1)</literal>.
- * The value will be copied or referenced by the store if appropriate.
+ *
+ * The value will be referenced by the store if it is a %G_TYPE_OBJECT, and it
+ * will be copied if it is a %G_TYPE_STRING or %G_TYPE_BOXED.
**/
void
gtk_tree_store_set (GtkTreeStore *tree_store,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]