gobject: Mention g_clear_object() in g_object_unref() documentation
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Fri, 19 Dec 2014 19:02:15 +0000 (19:02 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Tue, 3 Mar 2015 18:40:33 +0000 (18:40 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=741779

gobject/gobject.c

index 4a8d032..ae6265e 100644 (file)
@@ -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)