[Gtk-sharp-list] Patch for problem with event handler callbacks when there is an Object as input parameter

Aleksey Sanin aleksey@aleksey.com
Thu, 14 Aug 2003 10:36:15 -0700


This is a multi-part message in MIME format.
--------------030507040203060002060006
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

About a week ago I have reported to the list a crash I have with 
RowActivated
callback in Gtk.TreeView when I use Gtk# compiled from CVS.

I have investigated this issue and found that it is a general problem with
*any* signal handler that has an object as an input parameter (SetMark
in Gtk.TextBuffer, etc.) thus I have opened a bug about that:
   
    http://bugzilla.ximian.com/show_bug.cgi?id=47626

Finally I was able to find the problem: the signal handler code assumed
that it owns the object reference passed in. Thus it destroyed the object
and later GTK crashed as soon as it tries to destroy the object itself.

The one line patch is trivial (see attached file). I would appreciate if 
someone
can check it in (and close the bug :) ). This problem is really annoying :)

Thanks,
Aleksey









--------------030507040203060002060006
Content-Type: text/plain;
 name="signal.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="signal.diff"

Index: generator/SignalHandler.cs
===================================================================
RCS file: /mono/gtk-sharp/generator/SignalHandler.cs,v
retrieving revision 1.29
diff -u -r1.29 SignalHandler.cs
--- generator/SignalHandler.cs	23 Jul 2003 17:19:19 -0000	1.29
+++ generator/SignalHandler.cs	14 Aug 2003 17:29:51 -0000
@@ -140,7 +140,7 @@
 						sw.WriteLine("\t\t\t\targs.Args[{0}] = null;", idx - 1);
 						sw.WriteLine("\t\t\telse {");
 						if (wrapper != null && wrapper is ObjectGen)
-							sw.WriteLine("\t\t\t\targs.Args[" + (idx-1) + "] = GLib.Object.GetObject(arg" + idx + ", true);");
+							sw.WriteLine("\t\t\t\targs.Args[" + (idx-1) + "] = GLib.Object.GetObject(arg" + idx + ", false);");
 						else
 							sw.WriteLine("\t\t\t\targs.Args[" + (idx-1) + "] = " + table.FromNative (ctype, "arg" + idx)  + ";");
 						if ((wrapper != null && (wrapper is OpaqueGen)) || table.IsManuallyWrapped (ctype)) {

--------------030507040203060002060006--