Re: [pygtk] GObject reference handling

2003-03-06 Thread James Henstridge
James Henstridge wrote:

If anyone on the list has experience with the Python cycle GC, I would 
appreciate it if you could read over my reasoning, and hopefully spot 
any obvious mistakes.  If I can get this working, I would like to 
apply it for the next pygtk release.
Okay.  I found the problem (it was a fairly simple problem).  There is a 
fixed patch on bug 92955 now.

The main difference in behaviour with this change is that GObject 
subclasses with __del__ methods will not get released.  This behaviour 
comes from the cycle GC, since __del__ methods aren't usually written to 
function correctly when the instance dictionary has been cleared, for 
instance.

Is this likely to be a problem for anyone?  In my opinion, the gains 
from such a change outweigh the losses but I would like to hear other 
people's point of view if they disagree.  The patch is available here:
   http://bugzilla.gnome.org/showattachment.cgi?attach_id=14812

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] GObject reference handling

2003-03-05 Thread James Henstridge
I have recently been looking into the problem of disapearing member 
variables on GObject wrappers:
  http://bugzilla.gnome.org/show_bug.cgi?id=92955

I have a fairly good idea of why this happens: the cycle GC system 
thinks that the only references held on the wrapper are part of cycles, 
as it doesn't know about the hack in pygtk to resurrect the wrapper, so 
asks the instance dictionary to clear itself.

I believe the way to solve this problem is to get rid of the hacks in 
pygtk :)  I outline my proposed solution in the comment on the bug dated 
2003-03-05 06:16.

I also have an initial patch to implement this solution.  Unfortunately, 
things aren't quite working correctly.  The garbage collector never 
seems to call the GObject wrapper's tp_clear() method, so the wrapper 
(and GObject end up getting leaked).

If anyone on the list has experience with the Python cycle GC, I would 
appreciate it if you could read over my reasoning, and hopefully spot 
any obvious mistakes.  If I can get this working, I would like to apply 
it for the next pygtk release.

Thanks,

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/