[Gtk-sharp-list] Re: Gtk# refcount problem
16 Sep 2002 22:00:54 -0500
I think this is actually the same problem I triggered earlier with
gtk_widget_get_style: Despite what gtk.defs claims, there are methods in
gtk+ that return GObjects without reffing them. This problem doesn't
exist for the GtkObject case because of the float policy. Because the
vast majority of methods in Gtk+ are going to return GtkWidgets, the
problem isn't triggered for them.
The patch Martin provided will cause leaked references because of:
a) The methods that do ref before returning
b) Signals, which also call GetObject.
Instead, the correct approach is to set the needs_ref attribute on the=20
problem methods. Miguel, Martin, could you tell me what methods you're
having problems with?=20
On Sun, 2002-09-15 at 22:14, Mike Kestner wrote:
> Hi Martin,
> On Sun, 2002-09-15 at 10:01, Martin Baulig wrote:
> > there's a problem with the new refcounting code in gtk#:
> Can you describe how you are triggering the problem?
> > Currently, ObjectManager.CreateObject() may create several managed GLib=
.Object's for the
> > same underlying GObject. Since the GLib.Object's calls g_object_unref(=
) when it's
> > disposed, CreateObject() must g_object_ref() the GObject.
> The ObjectManager should only called through GLib.Object.GetObject,
> which checks to see if a wrapper has been created already and returns a
> ref to that object instead of creating a new wrapper through the
> So I don't believe the patch is correct.
> Mike Kestner <firstname.lastname@example.org>
> Gtk-sharp-list maillist - Gtkemail@example.com
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----