2006-03-27 Mike Kestner <mkestner@novell.com>
* glib/ListBase.cs : deal with ownership of Opaque elements. * glib/Marshaller.cs : add a hack to deal with Opaque ownership in ListToArray marshaling. svn path=/trunk/gtk-sharp/; revision=58609
This commit is contained in:
parent
4a251355f3
commit
16fef6601b
3 changed files with 16 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2006-03-27 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
|
* glib/ListBase.cs : deal with ownership of Opaque elements.
|
||||||
|
* glib/Marshaller.cs : add a hack to deal with Opaque ownership in
|
||||||
|
ListToArray marshaling.
|
||||||
|
|
||||||
2006-02-28 Mike Kestner <mkestner@novell.com>
|
2006-02-28 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* bootstrap-2.* : update for 2.x.2 releases.
|
* bootstrap-2.* : update for 2.x.2 releases.
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace GLib {
|
||||||
private IntPtr list_ptr = IntPtr.Zero;
|
private IntPtr list_ptr = IntPtr.Zero;
|
||||||
private int length = -1;
|
private int length = -1;
|
||||||
private bool managed = false;
|
private bool managed = false;
|
||||||
private bool elements_owned = false;
|
internal bool elements_owned = false;
|
||||||
protected System.Type element_type = null;
|
protected System.Type element_type = null;
|
||||||
|
|
||||||
abstract internal IntPtr NthData (uint index);
|
abstract internal IntPtr NthData (uint index);
|
||||||
|
@ -134,6 +134,8 @@ namespace GLib {
|
||||||
ret = data;
|
ret = data;
|
||||||
else if (element_type.IsSubclassOf (typeof (GLib.Object)))
|
else if (element_type.IsSubclassOf (typeof (GLib.Object)))
|
||||||
ret = GLib.Object.GetObject (data, false);
|
ret = GLib.Object.GetObject (data, false);
|
||||||
|
else if (element_type.IsSubclassOf (typeof (GLib.Opaque)))
|
||||||
|
ret = GLib.Opaque.GetOpaque (data, element_type, elements_owned);
|
||||||
else if (element_type == typeof (int))
|
else if (element_type == typeof (int))
|
||||||
ret = (int) data;
|
ret = (int) data;
|
||||||
else if (element_type.IsValueType)
|
else if (element_type.IsValueType)
|
||||||
|
@ -159,6 +161,8 @@ namespace GLib {
|
||||||
for (uint i = 0; i < Count; i++)
|
for (uint i = 0; i < Count; i++)
|
||||||
if (typeof (GLib.Object).IsAssignableFrom (element_type))
|
if (typeof (GLib.Object).IsAssignableFrom (element_type))
|
||||||
g_object_unref (NthData (i));
|
g_object_unref (NthData (i));
|
||||||
|
else if (typeof (GLib.Opaque).IsAssignableFrom (element_type))
|
||||||
|
GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
|
||||||
else
|
else
|
||||||
g_free (NthData (i));
|
g_free (NthData (i));
|
||||||
|
|
||||||
|
|
|
@ -286,6 +286,10 @@ namespace GLib {
|
||||||
Array result = Array.CreateInstance (type, list.Count);
|
Array result = Array.CreateInstance (type, list.Count);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
list.CopyTo (result, 0);
|
list.CopyTo (result, 0);
|
||||||
|
|
||||||
|
if (type.IsSubclassOf (typeof (GLib.Opaque)))
|
||||||
|
list.elements_owned = false;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue