On Jan 6, 2008, at 1:59 PM, Jeffrey Ratcliffe wrote: > On 05/01/2008, Emmanuele Bassi <[EMAIL PROTECTED]> wrote: >> try with: >> >> GdkRectangle_copy * >> >> instead of GtkRectangle_ornull *. > > That works, thanks for the help. > > Why didn't it work before?
Memory lifetime. The object returned to perl was pointing at the spot on the C stack where the rect lived. After the xsub returned, this no longer contained a rectangle, and just gave you randomly-changing garbage. I didn't crash because you didn't try to write to it, and the address was still inside the valid address space of the process. The _copy typemap variant instead creates a copy of the object, so the reference returned to perl points to its own heap copy of the rectangle. If you're morbidly curious, see the "Wrapping Boxed Types" section of the Binding HowTo: http://gtk2-perl.sourceforge.net/doc/binding_howto.pod.html#wrapping%20boxed%20types -- zella (crying): I want... us: What? zella (still crying): I want... something! _______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list