summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2014-12-19 19:02:15 +0000
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-03-03 18:40:33 +0000
commit4aedc85fb35f58b602259d34b94dcebeefa198bc (patch)
tree9d532e53ac364f73081cba01ad149aa84b23addb
parent18c9a4e17a74b1707b8a17779e13956e151edc27 (diff)
downloadglib-4aedc85fb35f58b602259d34b94dcebeefa198bc.tar.gz
gobject: Mention g_clear_object() in g_object_unref() documentation
https://bugzilla.gnome.org/show_bug.cgi?id=741779
-rw-r--r--gobject/gobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 4a8d0322e..ae6265ea6 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -3057,6 +3057,11 @@ g_object_ref (gpointer _object)
*
* Decreases the reference count of @object. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
+ *
+ * If the pointer to the #GObject may be reused in future (for example, if it is
+ * an instance variable of another object), it is recommended to clear the
+ * pointer to %NULL rather than retain a dangling pointer to a potentially
+ * invalid #GObject instance. Use g_clear_object() for this.
*/
void
g_object_unref (gpointer _object)