[Gtk-sharp-list] Re: Gtk# refcount problem
Rachel Hestilow
hestilow@ximian.com
16 Sep 2002 22:00:54 -0500
--=-F7xkWgcHeFl3TvsiWtOU
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
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
-- Rachel
On Sun, 2002-09-15 at 22:14, Mike Kestner wrote:
> Hi Martin,
>=20
> On Sun, 2002-09-15 at 10:01, Martin Baulig wrote:
>=20
> > there's a problem with the new refcounting code in gtk#:
>=20
> Can you describe how you are triggering the problem?
>=20
> > 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.
>=20
> 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
> ObjectManager.
>=20
> So I don't believe the patch is correct.
>=20
> --=20
> Mike Kestner <mkestner@speakeasy.net>
>=20
>=20
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>=20
--=-F7xkWgcHeFl3TvsiWtOU
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
iD8DBQA9hprmapOJdUj74F4RAnJaAKDOfzrs9bd6oYqCwibH9sK4puJvdgCgtAzB
BaQgp+wrRXIlTaWV+q2EbKI=
=q5A2
-----END PGP SIGNATURE-----
--=-F7xkWgcHeFl3TvsiWtOU--