GNOME Bugzilla – Bug 466082
pygobject_new_full not fully initialising PyGObject, chaos results
Last modified: 2007-08-14 16:06:27 UTC
pygobject_new_full() fails to initialise the private_flags.flags member. As a result the toggle ref code thinks it already has toggle refs turned on. Symptoms have been seen so far mostly in Epiphany: failure to shut down, extensions breaking continually, etc. Fun. It took me a little while to debug and I found what appear to be some other potential issues: * pygobject_clear does not unset PYGOBJECT_USING_TOGGLE_REF - could this mean that a subsequent wrapping of a GObject fails to get the right toggle semantics? * shouldn't pygobject_get_dict call pygobject_switch_to_toggle_ref() if the inst_dict is created? These are also addressed in the following patch.
Created attachment 93557 [details] [review] toggle-ref-fixes.patch
(In reply to comment #0) > pygobject_new_full() fails to initialise the private_flags.flags member. As a > result the toggle ref code thinks it already has toggle refs turned on. True, nice catch! > Symptoms have been seen so far mostly in Epiphany: failure to shut down, > extensions breaking continually, etc. Fun. > > It took me a little while to debug and I found what appear to be some other > potential issues: > * pygobject_clear does not unset PYGOBJECT_USING_TOGGLE_REF - could this mean > that a subsequent wrapping of a GObject fails to get the right toggle > semantics? When pygobject_clear is called, the python wrapper is about to be finalized/freed anyway, not much point in that.. but I guess no harm done either if you do it.. > * shouldn't pygobject_get_dict call pygobject_switch_to_toggle_ref() if the > inst_dict is created? Yes, I forgot this code path. I added a unit test to demonstrate this bug. > > These are also addressed in the following patch. > Looks good. Please commit.
(In reply to comment #2) > When pygobject_clear is called, the python wrapper is about to be > finalized/freed anyway, not much point in that.. but I guess no harm done > either if you do it.. Ah, of course. I like to see invariants maintained, though. > Looks good. Please commit. Can't - I'm just a reporter. No commit privileges.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.