Skip to content

gobject: Document it’s unsafe to call g_object_ref() from GWeakNotify

Philip Withnall requested to merge pwithnall/glib:object-weak-ref-docs into main

The documentation sort of already said this, but it’s better to make it explicit.

This avoids the situation where some of the weak notify callbacks for an object have been called, and then a subsequent one resurrects the object. Without some way of undoing the weak notifications already sent, that would leave external state which is coupled to the object’s lifecycle out of sync.

This arose from discussion on !2064 (merged).

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Merge request reports