[Gtk-sharp-list] Main thread unref patch.
Martin Baulig
martin@gnome.org
22 Mar 2003 20:32:03 +0100
Miguel de Icaza <miguel@ximian.com> writes:
> Since Destructors (they should really be called finalizers) will be
> invoked from a thread, and since Gtk+ is not thread safe, we should only
> invoke unref() from the Gtk main thread.
>
> The following patch queues objects for destruction on Dispose, and
> queues and Idle handler to perform the destructions in the context of
> the main thread.
Hi,
it looks like something in this patch broke the debugger.
I spent several hours trying to debug it and tried with all possible combinations of
mono/mcs/gtk-sharp versions with very surprising results:
* the current debugger from CVS works just fine with a 2 weeks old gtk#
* if you use the latest gtk# from CVS, and then compile the debugger, then sometimes you
get a Debugger.exe which always crashes on startup.
* if the Debugger.exe crashes, then it crashes each time you start it.
* if you change a few random lines in the source code and recompile, you get a different
Debugger.exe - and it either works always or crashes always.
The problem seems to be in
public static Object GetObject(IntPtr o)
{
WeakReference obj = Objects[o] as WeakReference;
if (obj != null)
return obj.Target as GLib.Object;
return GtkSharp.ObjectManager.CreateObject(o);
}
If the debugger crashes, then it's always because `obj != null', but `obj.Target == null'.
After spending some time trying to debug this, I finally gave up and installed a 2 weeks
old gtk# - the debugger now works fine with it.
Any ideas ?
--
Martin Baulig
martin@gnome.org
martin@ximian.com