[Gtk-sharp-list] Agressive ref-couting.
Rachel Hestilow
hestilow@ximian.com
11 Sep 2002 22:25:54 -0500
--=-pYn8WmTCnURXE8TIkQ/B
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Ah, I understand the problem I think. For some object fields we have to
write glue functions to return the field. None of these glue functions,
to my knowledge, ref the result. I'll whip up a patch to fix glue to ref
the return values.
-- Rachel
On Wed, 2002-09-11 at 21:24, Miguel de Icaza wrote:
> Hello!
>=20
> > > The following patch makes mPhoto work again, when GC happens, we a=
re
> > > destroying objects that we did not ref previously.
> >=20
> > I'm not sure this is the solution. We shouldn't need to ref every
> > object, because we should own the vast majority of handles that are
> > returned by native methods. Is this a situation where you are using
> > methods with "const" returns in the native library?
>=20
> The problem happens with GCs and Styles:
>=20
> static Gdk.GC EnsureGC (IntPtr raw) {
> if (raw =3D=3D IntPtr.Zero)
> return null;
> Gdk.GC ret =3D (Gdk.GC) GLib.Object.GetObject (raw);
> if (ret =3D=3D null)
> ret =3D new Gdk.GC (raw);
> return ret;
> }
>=20
> [DllImport("gtksharpglue")]
> static extern IntPtr gtksharp_gtk_style_get_white_gc (IntPtr style);
>=20
> public Gdk.GC WhiteGC {
> get { return EnsureGC (gtksharp_gtk_style_get_white_gc(Handle));
> }
>=20
> The problem is that we are wrapping an object which is owned somewhere
> else. =20
>=20
> Miguel
>=20
>=20
>=20
>=20
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>=20
--=-pYn8WmTCnURXE8TIkQ/B
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
iD8DBQA9gAlCapOJdUj74F4RApQ3AKC+Fvtp0TbmYYkvoww83h5ebSvvWgCgjyDv
dqCHyxvMU2Bzi+G2vj8Bvs4=
=0UCF
-----END PGP SIGNATURE-----
--=-pYn8WmTCnURXE8TIkQ/B--