From 772790dcb07a5d788bc4414787d15e7935886627 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Tue, 15 Apr 2008 17:43:55 +0000 Subject: [PATCH] 2008-04-15 Mike Kestner * glib/Marshaller.cs: marshal null string arrays as a null IntPtr[]. [Fixes #378514] svn path=/trunk/gtk-sharp/; revision=100744 --- ChangeLog | 5 +++++ glib/Marshaller.cs | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ff6ed05df..7815f2c76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-04-15 Mike Kestner + + * glib/Marshaller.cs: marshal null string arrays as a null IntPtr[]. + [Fixes #378514] + 2008-04-14 Mike Kestner * gtk/Application.cs: add QuitPrepare event for Gnome.Program usage. diff --git a/glib/Marshaller.cs b/glib/Marshaller.cs index 9815744e8..e2ae0f92c 100644 --- a/glib/Marshaller.cs +++ b/glib/Marshaller.cs @@ -39,6 +39,9 @@ namespace GLib { public static void Free (IntPtr[] ptrs) { + if (ptrs == null) + return; + for (int i = 0; i < ptrs.Length; i++) g_free (ptrs [i]); } @@ -142,7 +145,7 @@ namespace GLib { public static IntPtr[] StringArrayToNullTermPointer (string[] strs) { if (strs == null) - return new IntPtr [0]; + return null; IntPtr[] result = new IntPtr [strs.Length + 1]; for (int i = 0; i < strs.Length; i++) result [i] = StringToPtrGStrdup (strs [i]);