2008-04-15 Mike Kestner <mkestner@novell.com>

* generator/ReturnValue.cs: use new GLib.Opaque.OwnedCopy for owned
	opaque return values.
	* glib/Opaque.cs: introduce OwnedCopy property to support returning
	owned opaque instances from native to managed callbacks. 
	[Fixes #374641]

svn path=/trunk/gtk-sharp/; revision=100762
This commit is contained in:
Mike Kestner 2008-04-15 19:43:16 +00:00
parent a1c4fb0689
commit 11286d19c6
3 changed files with 18 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2008-04-15 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs: use new GLib.Opaque.OwnedCopy for owned
opaque return values.
* glib/Opaque.cs: introduce OwnedCopy property to support returning
owned opaque instances from native to managed callbacks.
[Fixes #374641]
2008-04-15 Mike Kestner <mkestner@novell.com> 2008-04-15 Mike Kestner <mkestner@novell.com>
* gtk/Gtk.metadata: hide GtkKey_ for manual impl. * gtk/Gtk.metadata: hide GtkKey_ for manual impl.

View file

@ -150,6 +150,8 @@ namespace GtkSharp.Generation {
return (IGen as IManualMarshaler).AllocNative (var); return (IGen as IManualMarshaler).AllocNative (var);
else if (IGen is ObjectGen && owned) else if (IGen is ObjectGen && owned)
return var + " == null ? IntPtr.Zero : " + var + ".OwnedHandle"; return var + " == null ? IntPtr.Zero : " + var + ".OwnedHandle";
else if (IGen is OpaqueGen && owned)
return var + " == null ? IntPtr.Zero : " + var + ".OwnedCopy";
else else
return IGen.ToNativeReturn (var); return IGen.ToNativeReturn (var);
} }

View file

@ -113,6 +113,14 @@ namespace GLib {
} }
} }
public IntPtr OwnedCopy {
get {
Opaque result = Copy (Handle);
result.Owned = false;
return result.Handle;
}
}
public bool Owned { public bool Owned {
get { get {
return owned; return owned;