From: Guido S. <__g...@we...> - 2005-05-31 22:02:12
|
On Mon, 30 May 2005 20:30:44 +0100 Stephen Watson <st...@ke...> wrote: > "Ken Hayber" <ke...@ha...> wrote: > > > On Mon, May 30, 2005 9:46 am, Stephen Watson said: > > > Guido Schimmels <__g...@we...> wrote: > > > > > >> > > >> Those changes break it for me: > > >> > > >> 19-May-2005 > > >> ~~~~~~~~~~~ > > >> Clean up of icon theme handling (Stephen Watson). > > >> > > >> > > >> Sympton when trying to open a SaveBox: > > >> no SaveBox, 100% CPU ad infinitum > > > > > > Running what? > > > > > >> 18-May-2005 is OK. > > >> > > >> (gtk-2.6.4 pygtk-2.6.2) > > > > > > Archive works with gtk 2.4 and pygtk 2.4 Any body else with 2.6? > > > > Yup. No problems here. gtk 2.6.7, pygtk 2.6.1 > > It might be theme related then. No, I think I got it. In fact removing info.free() (good catch, Ken!) is the proper fix. This doesn't come at the expence of a leak, but is perfectly alright. And this is why: From the pygtk gtk-doc reference: <quote> class gtk.IconInfo(gobject.GBoxed): .... +-- gobject.GBoxed Description gobject.GBoxed is an abstract base class that encapsulates an opaque chunk of data to provide an object-oriented interface and a type that is registered with the GLIB type system. A boxed type is registered with functions that provide for the copying and freeing of the underlying data structure - this allows PyGTK to encapsulate these as Python objects. </quote> So gtk.IconInfo registers callbacks with the python interpreter. When the object is unreferenced gtk.IconInfo.free() is always implicitly been called. That fits perfectly with my investigation. I added a gc.collect() after info.free(), then *precisly on function exit* it would segfault. (Ken found out it's a double-free() - makes sense) This raises the question why the pygtk devs have implemented gtk.IconInfo.free() in the first place. When would you call it - won't it always wreak havoc? Probably there is a way to cancel gobject unboxing for a particular object instance? Anyway, the docs should contain a clear warning. |