зеркало из https://github.com/mono/mail-archives.git
156 строки
4.8 KiB
HTML
156 строки
4.8 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Gtk-sharp-list] Gtk# refcount problem
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:martin%40gnome.org">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="000347.html">
|
|
<LINK REL="Next" HREF="000354.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Gtk-sharp-list] Gtk# refcount problem
|
|
</H1>
|
|
<B>Martin Baulig
|
|
</B>
|
|
<A HREF="mailto:martin%40gnome.org"
|
|
TITLE="[Gtk-sharp-list] Gtk# refcount problem">martin@gnome.org
|
|
</A><BR>
|
|
<I>15 Sep 2002 17:01:34 +0200</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="000347.html">[Gtk-sharp-list] Windows Compilation
|
|
</A></li>
|
|
<LI> Next message: <A HREF="000354.html">[Gtk-sharp-list] Re: Gtk# refcount problem
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#353">[ date ]</a>
|
|
<a href="thread.html#353">[ thread ]</a>
|
|
<a href="subject.html#353">[ subject ]</a>
|
|
<a href="author.html#353">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>--=-=-=
|
|
|
|
Hi,
|
|
|
|
there's a problem with the new refcounting code in gtk#:
|
|
|
|
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.
|
|
|
|
Here's a patch:
|
|
|
|
|
|
--=-=-=
|
|
Content-Type: application/octet-stream
|
|
Content-Disposition: attachment; filename=diff
|
|
|
|
? api/generated-stamp
|
|
? parser/gapi_format_xml
|
|
Index: glib/ObjectManager.cs
|
|
===================================================================
|
|
RCS file: /cvs/public/gtk-sharp/glib/ObjectManager.cs,v
|
|
retrieving revision 1.5
|
|
diff -u -u -r1.5 ObjectManager.cs
|
|
--- glib/ObjectManager.cs 20 Aug 2002 19:56:17 -0000 1.5
|
|
+++ glib/ObjectManager.cs 15 Sep 2002 15:02:18 -0000
|
|
@@ -30,7 +30,9 @@
|
|
Type t = Type.GetType (mangled);
|
|
if (t == null)
|
|
return null;
|
|
- return (GLib.Object) Activator.CreateInstance (t, new object[] {raw});
|
|
+ GLib.Object retval = (GLib.Object) Activator.CreateInstance (t, new object[] {raw});
|
|
+ retval.Ref ();
|
|
+ return retval;
|
|
}
|
|
|
|
public static void RegisterType (string native_name, string managed_name, string assembly)
|
|
Index: gnome/Modules.cs
|
|
===================================================================
|
|
RCS file: /cvs/public/gtk-sharp/gnome/Modules.cs,v
|
|
retrieving revision 1.2
|
|
diff -u -u -r1.2 Modules.cs
|
|
--- gnome/Modules.cs 30 Jul 2002 23:02:11 -0000 1.2
|
|
+++ gnome/Modules.cs 15 Sep 2002 15:02:19 -0000
|
|
@@ -3,7 +3,7 @@
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
- class Modules
|
|
+ public class Modules
|
|
{
|
|
[DllImport("libgnome-2.so.0")]
|
|
static extern System.IntPtr libgnome_module_info_get ();
|
|
Index: sample/CanvasExample.cs
|
|
===================================================================
|
|
RCS file: /cvs/public/gtk-sharp/sample/CanvasExample.cs,v
|
|
retrieving revision 1.2
|
|
diff -u -u -r1.2 CanvasExample.cs
|
|
--- sample/CanvasExample.cs 6 Aug 2002 05:42:57 -0000 1.2
|
|
+++ sample/CanvasExample.cs 15 Sep 2002 15:02:19 -0000
|
|
@@ -115,6 +115,7 @@
|
|
sa.RetVal = true;
|
|
return;
|
|
}
|
|
+ break;
|
|
case EventType.TwoButtonPress:
|
|
ChangeItemColor (item);
|
|
sa.RetVal = true;
|
|
Index: sample/Scribble.cs
|
|
===================================================================
|
|
RCS file: /cvs/public/gtk-sharp/sample/Scribble.cs,v
|
|
retrieving revision 1.2
|
|
diff -u -u -r1.2 Scribble.cs
|
|
--- sample/Scribble.cs 4 Aug 2002 04:23:13 -0000 1.2
|
|
+++ sample/Scribble.cs 15 Sep 2002 15:02:19 -0000
|
|
@@ -30,10 +30,10 @@
|
|
darea.MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEvent);
|
|
darea.ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEvent);
|
|
darea.Events = (int)EventMask.ExposureMask |
|
|
- EventMask.LeaveNotifyMask |
|
|
- EventMask.ButtonPressMask |
|
|
- EventMask.PointerMotionMask |
|
|
- EventMask.PointerMotionHintMask;
|
|
+ (int)EventMask.LeaveNotifyMask |
|
|
+ (int)EventMask.ButtonPressMask |
|
|
+ (int)EventMask.PointerMotionMask |
|
|
+ (int)EventMask.PointerMotionHintMask;
|
|
|
|
win.ShowAll ();
|
|
Application.Run ();
|
|
|
|
--=-=-=
|
|
|
|
|
|
--
|
|
Martin Baulig
|
|
<A HREF="mailto:martin@gnome.org">martin@gnome.org</A>
|
|
|
|
|
|
--=-=-=--
|
|
|
|
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="000347.html">[Gtk-sharp-list] Windows Compilation
|
|
</A></li>
|
|
<LI> Next message: <A HREF="000354.html">[Gtk-sharp-list] Re: Gtk# refcount problem
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#353">[ date ]</a>
|
|
<a href="thread.html#353">[ thread ]</a>
|
|
<a href="subject.html#353">[ subject ]</a>
|
|
<a href="author.html#353">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|