After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 466082 - pygobject_new_full not fully initialising PyGObject, chaos results
pygobject_new_full not fully initialising PyGObject, chaos results
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
2.13.x
Other Linux
: Normal major
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2007-08-12 22:59 UTC by Ed Catmur
Modified: 2007-08-14 16:06 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
toggle-ref-fixes.patch (1.10 KB, patch)
2007-08-12 22:59 UTC, Ed Catmur
committed Details | Review

Description Ed Catmur 2007-08-12 22:59:24 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.
Comment 1 Ed Catmur 2007-08-12 22:59:56 UTC
Created attachment 93557 [details] [review]
toggle-ref-fixes.patch
Comment 2 Gustavo Carneiro 2007-08-13 10:26:21 UTC
(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.
Comment 3 Ed Catmur 2007-08-14 07:13:27 UTC
(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.
Comment 4 Gustavo Carneiro 2007-08-14 16:06:27 UTC
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.