On Sun, 2008-01-06 at 19:59 +0100, 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?

GdkRectangle_ornull will not copy the return value, but will just return
a pointer (plus safety check on NULL values); since the GdkRectangle is
put on the stack, this means that you'll get garbage as soon as you try
to access the pointer from outside the function.

GdkRectangle_copy will copy the stack allocated value into the heap,
thus giving back valid data (the memory will be deallocated when the
scalar gets garbage collected).

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to