This is the mail archive of the
guile-gtk@sources.redhat.com
mailing list for the Guile project.
Re: Fixed memory leaks in gdk-1.2.defs
Kevin Ryde <user42@zip.com.au>:
> Marko Rauhamaa <marko@pacujo.net> writes:
> >
> > - build-guile-gtk-1.2, guile-gtk.c: GDK and GTK differ in the
> > reference count policy. While GTK returns the widgets with a
> > reference count 0, GDK returns them with a reference count 1.
> > That means that gdk-1.2.defs should not increment the reference
> > count -- but it was doing that.
>
> I don't know if it's this change or something else, but I seem to now
> be losing references to GdkFont.
Yeah, I was confused about the copying semantics. I have now submitted a
fix.
BTW, the copying rules are as follows:
You MUST COPY the return value of a C function if the C function
returns
* a fresh object with reference count 0,
* one of its arguments as is,
* a field of one of its arguments as is or
* a global object as is.
You MUST NOT COPY the return value of a C function if the C function
* returns a fresh object with a reference count 1,
* returns one of its arguments after incrementing the reference count,
* returns a field of one of its arguments after incrementing reference
count or
* dequeues an object and hands it over to the caller.
Marko
--
Marko Rauhamaa mailto:marko@pacujo.net http://pacujo.net/marko/