[PATCH] undead objects [was Re: Speedup insert into treestore]




On Oct 11, 2005, at 9:34 AM, muppet wrote:

Congratulations! You've found a reference-handling bug in Glib::Object!
[...]
It's at this point that things blow up. The C object doesn't know that there is a perl wrapper attached, so it happily dies, assuming it has had a full-enough life. The perl wrapper object is left pointing to freed memory, which is why you keep getting assertions that your apple is not an apple -- it's actually a ghost apple.

The solution here will be some form of GObject trickery in the Glib binding,

srwalter dropped this link in IRC last night:

http://oscillatingkinematics.org/gtk2-perl-locking.diff

The bug exists in situations where the "undead" perl wrapper must be revived. The current code recognizes this situation as asking to own an object with one reference; the C object gets a reference only if the wrapper wants to own the object. This happens for all GtkObjects (thanks to the sink semantics) but very rarely for things deriving directly from GObject. Steven's patch adds an explicit "undead" state for the wrapper, set in Glib::Object::DESTROY and cleared in gperl_object_get().

Comments on the patch?

--
Package contains eight 13-inch aliens in assorted colors.
 -- Catalog copy for space invaders wall decals.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]