mail-archives/gtk-sharp-list/2002-September/000330.html

90 строки
2.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Agressive ref-couting.
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:miguel%40ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="000328.html">
<LINK REL="Next" HREF="000331.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Agressive ref-couting.
</H1>
<B>Miguel de Icaza
</B>
<A HREF="mailto:miguel%40ximian.com"
TITLE="[Gtk-sharp-list] Agressive ref-couting.">miguel@ximian.com
</A><BR>
<I>11 Sep 2002 22:24:39 -0400</I>
<P><UL>
<LI> Previous message: <A HREF="000328.html">[Gtk-sharp-list] Agressive ref-couting.
</A></li>
<LI> Next message: <A HREF="000331.html">[Gtk-sharp-list] Agressive ref-couting.
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#330">[ date ]</a>
<a href="thread.html#330">[ thread ]</a>
<a href="subject.html#330">[ subject ]</a>
<a href="author.html#330">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hello!
&gt;<i> &gt; The following patch makes mPhoto work again, when GC happens, we are
</I>&gt;<i> &gt; destroying objects that we did not ref previously.
</I>&gt;<i>
</I>&gt;<i> I'm not sure this is the solution. We shouldn't need to ref every
</I>&gt;<i> object, because we should own the vast majority of handles that are
</I>&gt;<i> returned by native methods. Is this a situation where you are using
</I>&gt;<i> methods with &quot;const&quot; returns in the native library?
</I>
The problem happens with GCs and Styles:
static Gdk.GC EnsureGC (IntPtr raw) {
if (raw == IntPtr.Zero)
return null;
Gdk.GC ret = (Gdk.GC) GLib.Object.GetObject (raw);
if (ret == null)
ret = new Gdk.GC (raw);
return ret;
}
[DllImport(&quot;gtksharpglue&quot;)]
static extern IntPtr gtksharp_gtk_style_get_white_gc (IntPtr style);
public Gdk.GC WhiteGC {
get { return EnsureGC (gtksharp_gtk_style_get_white_gc(Handle));
}
The problem is that we are wrapping an object which is owned somewhere
else.
Miguel
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="000328.html">[Gtk-sharp-list] Agressive ref-couting.
</A></li>
<LI> Next message: <A HREF="000331.html">[Gtk-sharp-list] Agressive ref-couting.
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#330">[ date ]</a>
<a href="thread.html#330">[ thread ]</a>
<a href="subject.html#330">[ subject ]</a>
<a href="author.html#330">[ author ]</a>
</LI>
</UL>
</body></html>