2005-03-31 Mike Kestner <mkestner@novell.com>

* glib/ManagedValue.cs : add null/NULL guarding to Copy, Free, 
	WrapObject, and ObjectForWrapper.  [Fixes #74197]

svn path=/trunk/gtk-sharp/; revision=42434
This commit is contained in:
Mike Kestner 2005-03-31 16:31:31 +00:00
parent fb6aeb35da
commit e3a26238b6
3 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-03-31 Mike Kestner <mkestner@novell.com>
* glib/ManagedValue.cs : add null/NULL guarding to Copy, Free,
WrapObject, and ObjectForWrapper. [Fixes #74197]
2005-03-30 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* parser/gapi2xml.pl : parse gst type macros.

View File

@ -56,23 +56,31 @@ namespace GLib {
static IntPtr Copy (IntPtr ptr)
{
if (ptr == IntPtr.Zero)
return ptr;
GCHandle gch = (GCHandle) ptr;
return (IntPtr) GCHandle.Alloc (gch.Target);
}
static void Free (IntPtr ptr)
{
if (ptr == IntPtr.Zero)
return;
GCHandle gch = (GCHandle) ptr;
gch.Free ();
}
public static IntPtr WrapObject (object obj)
{
if (obj == null)
return IntPtr.Zero;
return (IntPtr) GCHandle.Alloc (obj);
}
public static object ObjectForWrapper (IntPtr ptr)
{
if (ptr == IntPtr.Zero)
return null;
return ((GCHandle)ptr).Target;
}
}

View File

@ -24,7 +24,7 @@ namespace GtkSamples {
private static void PopulateStore ()
{
store = new ListStore (typeof (Pair));
string[] combs = {"foo", "bar", "baz", "quux"};
string[] combs = {null, "foo", "bar", "baz"};
foreach (string a in combs) {
foreach (string b in combs) {
store.AppendValues (new Pair (a, b));