GNOME Bugzilla – Bug 749659
Cannot remove weak ref during the notify of another weak ref
Last modified: 2015-10-22 18:05:09 UTC
This causes a warning to be printed. Discovered while writing a test for Builder's EggStateMachine.
Created attachment 303721 [details] [review] Allow a GObject weak ref notify to remove another weak ref
Thanks for tracking this down. Since we use weak refs so heavily this would be nice to get in this cycle.
Created attachment 303722 [details] [review] Allow a GObject weak ref notify to remove another weak ref v2 Minor cleanup
I don't think this is really a bug -- see the duplicate for an explanation. *** This bug has been marked as a duplicate of bug 745678 ***
Review of attachment 303722 [details] [review]: ::: gobject/gobject.c @@ +2632,3 @@ + g_array_remove_index_fast (weak_refs, 0); + + tmp.notify (tmp.data, object); In case of a weak ref cycle, will this not cause a g_warning() when the call back to remove the weak ref from this object fails to find the weak ref. A more solid approach is probably to mark the weak ref as triggered, and then remove all weak refs at the end.