g_object_weak_ref, g_object_add_weak_pointer: document non-thread-safety

Transparent access to a weak pointer from the thread performing the
weak -> strong conversion is incompatible with thread-safety: that
thread will have to do something special. This is GNOME#548954.

https://bugzilla.gnome.org/show_bug.cgi?id=548954
This commit is contained in:
Simon McVittie 2011-12-06 11:37:45 +00:00 committed by Ryan Lortie
parent 1425aa664d
commit 28c87a5594

View File

@ -2462,6 +2462,10 @@ weak_refs_notify (gpointer data)
* "weak references" because they allow you to safely hold a pointer
* to an object without calling g_object_ref() (g_object_ref() adds a
* strong reference, that is, forces the object to stay alive).
*
* Note that the weak references created by this method are not
* thread-safe: they cannot safely be used in one thread if the
* object's last g_object_unref() might happen in another thread.
*/
void
g_object_weak_ref (GObject *object,
@ -2546,6 +2550,11 @@ g_object_weak_unref (GObject *object,
* the pointer located at @weak_pointer_location is only valid during
* the lifetime of @object. When the @object is finalized,
* @weak_pointer will be set to %NULL.
*
* Note that as with g_object_weak_ref(), the weak references created by
* this method are not thread-safe: they cannot safely be used in one
* thread if the object's last g_object_unref() might happen in another
* thread.
*/
void
g_object_add_weak_pointer (GObject *object,