2007-03-06 Mike Kestner <mkestner@novell.com>
* generator/Signal.cs : add try/catch blocks to native callback virtual method delegate too. svn path=/trunk/gtk-sharp/; revision=73849
This commit is contained in:
parent
32de2832db
commit
da407f8ed7
2 changed files with 30 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2007-03-06 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
|
* generator/Signal.cs : add try/catch blocks to native callback
|
||||||
|
virtual method delegate too.
|
||||||
|
|
||||||
2007-03-06 Mike Kestner <mkestner@novell.com>
|
2007-03-06 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* generator/Signal.cs : add try/catch blocks to native callback
|
* generator/Signal.cs : add try/catch blocks to native callback
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
//
|
//
|
||||||
// Copyright (c) 2001-2003 Mike Kestner
|
// Copyright (c) 2001-2003 Mike Kestner
|
||||||
// Copyright (c) 2003-2005 Novell, Inc.
|
// Copyright (c) 2003-2005 Novell, Inc.
|
||||||
|
// Copyright (c) 2007 Novell, Inc.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of version 2 of the GNU General Public
|
// modify it under the terms of version 2 of the GNU General Public
|
||||||
|
@ -154,6 +155,16 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HasOutParams {
|
||||||
|
get {
|
||||||
|
foreach (Parameter p in parms) {
|
||||||
|
if (p.PassAs == "out")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsEventHandler {
|
public bool IsEventHandler {
|
||||||
get {
|
get {
|
||||||
return retval.CSType == "void" && parms.Count == 1 && (parms [0].Generatable is ObjectGen || parms [0].Generatable is InterfaceGen);
|
return retval.CSType == "void" && parms.Count == 1 && (parms [0].Generatable is ObjectGen || parms [0].Generatable is InterfaceGen);
|
||||||
|
@ -368,13 +379,22 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine ("\t\tstatic {0} {1};\n", Name + "VMDelegate", Name + "VMCallback");
|
sw.WriteLine ("\t\tstatic {0} {1};\n", Name + "VMDelegate", Name + "VMCallback");
|
||||||
sw.WriteLine ("\t\tstatic " + retval.ToNativeType + " " + Name.ToLower() + "_cb (" + isig.ToString () + ")");
|
sw.WriteLine ("\t\tstatic " + retval.ToNativeType + " " + Name.ToLower() + "_cb (" + isig.ToString () + ")");
|
||||||
sw.WriteLine ("\t\t{");
|
sw.WriteLine ("\t\t{");
|
||||||
sw.WriteLine ("\t\t\t{0} {1}_managed = GLib.Object.GetObject ({1}, false) as {0};", implementor != null ? implementor.Name : container_type.Name, parms[0].Name);
|
sw.WriteLine ("\t\t\ttry {");
|
||||||
sw.Write (call.Setup ("\t\t\t"));
|
sw.WriteLine ("\t\t\t\t{0} {1}_managed = GLib.Object.GetObject ({1}, false) as {0};", implementor != null ? implementor.Name : container_type.Name, parms[0].Name);
|
||||||
sw.Write ("\t\t\t{0}", IsVoid ? "" : retval.CSType == retval.ToNativeType ? "return " : retval.CSType + " raw_ret = ");
|
sw.Write (call.Setup ("\t\t\t\t"));
|
||||||
|
sw.Write ("\t\t\t\t{0}", IsVoid ? "" : retval.CSType == retval.ToNativeType ? "return " : retval.CSType + " raw_ret = ");
|
||||||
sw.WriteLine ("{2}_managed.{0} ({1});", "On" + Name, call.ToString (), parms[0].Name);
|
sw.WriteLine ("{2}_managed.{0} ({1});", "On" + Name, call.ToString (), parms[0].Name);
|
||||||
sw.Write (call.Finish ("\t\t\t"));
|
sw.Write (call.Finish ("\t\t\t\t"));
|
||||||
if (!IsVoid && retval.CSType != retval.ToNativeType)
|
if (!IsVoid && retval.CSType != retval.ToNativeType)
|
||||||
sw.WriteLine ("\t\t\treturn {0};", SymbolTable.Table.ToNativeReturn (retval.CType, "raw_ret"));
|
sw.WriteLine ("\t\t\t\treturn {0};", SymbolTable.Table.ToNativeReturn (retval.CType, "raw_ret"));
|
||||||
|
sw.WriteLine ("\t\t\t} catch (Exception e) {");
|
||||||
|
bool fatal = HasOutParams || !IsVoid;
|
||||||
|
sw.WriteLine ("\t\t\t\tGLib.ExceptionManager.RaiseUnhandledException (e, " + (fatal ? "true" : "false") + ");");
|
||||||
|
if (fatal) {
|
||||||
|
sw.WriteLine ("\t\t\t\t// NOTREACHED: above call doesn't return");
|
||||||
|
sw.WriteLine ("\t\t\t\tthrow e;");
|
||||||
|
}
|
||||||
|
sw.WriteLine ("\t\t\t}");
|
||||||
sw.WriteLine ("\t\t}\n");
|
sw.WriteLine ("\t\t}\n");
|
||||||
sw.WriteLine ("\t\tprivate static void Override" + Name + " (GLib.GType gtype)");
|
sw.WriteLine ("\t\tprivate static void Override" + Name + " (GLib.GType gtype)");
|
||||||
sw.WriteLine ("\t\t{");
|
sw.WriteLine ("\t\t{");
|
||||||
|
|
Loading…
Reference in a new issue