2009-01-07 Mike Kestner <mkestner@novell.com>

* generator/MethodBody.cs: avoid null ref when passing null to
	destroy notified callback parameters. [Fixes #464120]

svn path=/trunk/gtk-sharp/; revision=122677
This commit is contained in:
Mike Kestner 2009-01-07 17:10:08 +00:00
parent b9af715527
commit f38c129f6d
2 changed files with 6 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2009-01-07 Mike Kestner <mkestner@novell.com>
* generator/MethodBody.cs: avoid null ref when passing null to
destroy notified callback parameters. [Fixes #464120]
2009-01-06 Mike Kestner <mkestner@novell.com>
* configure.in.in: update to use mdoc.

View file

@ -103,16 +103,13 @@ namespace GtkSharp.Generation {
string wrapper = cbgen.GenWrapper(gen_info);
switch (p.Scope) {
case "notified":
sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper;", wrapper, name);
sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper = new {0} ({1});", wrapper, name);
sw.WriteLine (indent + "\t\t\tIntPtr {0};", parameters [i + 1].Name);
sw.WriteLine (indent + "\t\t\t{0} {1};", parameters [i + 2].CSType, parameters [i + 2].Name);
sw.WriteLine (indent + "\t\t\tif ({0} == null) {{", name);
sw.WriteLine (indent + "\t\t\t\t{0}_wrapper = null;", name);
sw.WriteLine (indent + "\t\t\t\t{0} = IntPtr.Zero;", parameters [i + 1].Name);
sw.WriteLine (indent + "\t\t\t\t{0} = null;", parameters [i + 2].Name);
sw.WriteLine (indent + "\t\t\t} else {");
sw.WriteLine (indent + "\t\t\t\t{0}_wrapper = new {1} ({0});", name, wrapper);
sw.WriteLine (indent + "\t\t\t\t{0} = (IntPtr) GCHandle.Alloc ({1}_wrapper);", parameters [i + 1].Name, name);
sw.WriteLine (indent + "\t\t\t\t{0} = GLib.DestroyHelper.NotifyHandler;", parameters [i + 2].Name, parameters [i + 2].CSType);
sw.WriteLine (indent + "\t\t\t}");