Method

GObjectObjectadd_weak_pointer

Declaration

void
g_object_add_weak_pointer (
  GObject* object,
  gpointer* weak_pointer_location
)

Description

Adds a weak reference from weak_pointer to object to indicate that 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. Use GWeakRef if thread-safety is required.

This method is not directly available to language bindings.

Parameters

weak_pointer_location

Type: gpointer*

The memory address of a pointer.

The argument will be modified by the function.