[Gtk-sharp-list] Main thread unref patch.

Martin Baulig martin@gnome.org
23 Mar 2003 19:03:18 +0100


--=-=-=

Hi,

after doing some more debugging, I finally found and fixed the problem :-)

Here's the patch:

====
2003-03-23  Martin Baulig  <martin@ximian.com>

	* glib/Object.cs (Dispose): Call `Objects.Remove (_obj)' here
	instead of in PerformQueuedUnrefs().

====


--=-=-=
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=diff

Index: ChangeLog
===================================================================
RCS file: /cvs/public/gtk-sharp/ChangeLog,v
retrieving revision 1.363
diff -u -u -p -r1.363 ChangeLog
--- ChangeLog	22 Mar 2003 17:48:42 -0000	1.363
+++ ChangeLog	23 Mar 2003 18:04:54 -0000
@@ -1,3 +1,8 @@
+2003-03-23  Martin Baulig  <martin@ximian.com>
+
+	* glib/Object.cs (Dispose): Call `Objects.Remove (_obj)' here
+	instead of in PerformQueuedUnrefs().
+
 2003-03-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
 	* sample/Fifteen.cs: work-around for bug 106145 in gnome bugzilla.
Index: glib/Object.cs
===================================================================
RCS file: /cvs/public/gtk-sharp/glib/Object.cs,v
retrieving revision 1.43
diff -u -u -p -r1.43 Object.cs
--- glib/Object.cs	15 Mar 2003 20:49:37 -0000	1.43
+++ glib/Object.cs	23 Mar 2003 18:04:57 -0000
@@ -66,7 +66,6 @@ namespace GLib {
 				if (o._obj == IntPtr.Zero)
 					continue;
 				
-				Objects.Remove (o._obj);
 				o.Unref ();
 				o._obj = IntPtr.Zero;
 			}
@@ -89,6 +88,7 @@ namespace GLib {
 				return;
 
 			disposed = true;
+			Objects.Remove (_obj);
 			lock (PendingDestroys){
 				PendingDestroys.Enqueue (this);
 				lock (typeof (Object)){

--=-=-=


The problem was that GetObject() returned an object which was about to be finalized.

-- 
Martin Baulig
martin@gnome.org
martin@ximian.com

--=-=-=--