GtkSharp/generator
Dan Winship eb4fdee774 Automatic memory management for opaque types [#49565]
* glib/Opaque.cs (Owned): new property saying whether or not gtk#
	owns the memory.
	(Opaque): Set Owned to true in the void ctor and false in the
	IntPtr one.
	(GetOpaque): add a new overload that can also create opaques, a la
	GLib.Object.GetObject.
	(Ref, Unref, Free): empty virtual methods to be overridden by
	subclasses.
	(set_Raw): Unref() and possibly Free() the old value, Ref() the
	new one.
	(~Opaque, Dispose): set Raw to IntPtr.Zero (triggering Free/Unref
	if needed)

	* parser/gapi2xml.pl (addReturnElem): if the method is named Copy
	and returns a pointer, set the "owned" attribute on the
	return-type.

	* */*-api.raw: Regen
	
	* generator/HandleBase.cs (FromNative): Add new
	FromNative/FromNativeReturn overloads that takes a "bool owned"
	param. Implement the 1-arg FromNative and FromNativeReturn in
	terms of that.

	* generator/ObjectBase.cs (FromNative): Implement HandleBase's new
	overload. Use the two-arg version of GLib.Object.GetObject when
	"owned" is true.

	* generator/OpaqueGen.cs (Generate): Pull out Ref, Unref, and
	Free/Destroy/Dispose methods and handle them specially by
	overriding Opaque.Ref, .Unref, and .Free appropriately. (If any
	of the methods are marked deprecated, output a deprecated
	do-nothing method as well, to save us from having to write all
	those deprecated methods by hand.)
	(FromNative): use GetOpaque, passing "owned".

	* generator/ReturnValue.cs (FromNative): if the value is a
	HandleBase, pass Owned to its FromNative().

	* generator/Parameters.cs (Owned): new property (for use on out
	params)
	(FromNative): Call FromNative() on the generatable, handling Owned
	in the case of HandleBase.

	* generator/ManagedCallString.cs:
	* generator/MethodBody.cs:
	* generator/Signal.cs: use param.FromNative() rather than
	param.Generatable.FromNative(), to get ownership right.

	* */*.metadata: Mark opaque ref/unref/free methods deprecated
	(except where we were hiding them before). Add "owned" attributes
	to return values and out params as needed.

	* pango/AttrIterator.custom (GetFont): work around a
	memory-management oddity of the underlying method.

	* pango/AttrFontDesc.cs (AttrFontDesc): copy the passed-in
	FontDescriptor, since the attribute will assume ownership of it.

	* gtk/TreeView.custom (GetPathAtPos): set the "owned" flag on the
	returned TreePaths.

	* gtk/TargetList.custom: Remove refcounting stuff, which is
	now handled automatically

	* gtk/NodeStore.cs (GetPath): clear the Owned flag on the created
	TreePath so that the underlying structure doesn't get freed when
	the function returns

	* gtkhtml/HTMLStream.custom (Destroy): hide this and then
	reimplement it by hand to keep OpaqueGen from using it in
	Dispose(), since calling it after an HTMLStream.Close() will
	result in a crash.

svn path=/trunk/gtk-sharp/; revision=47928
2005-08-02 18:45:21 +00:00
..
AliasGen.cs 2004-12-27 Mike Kestner <mkestner@novell.com> 2004-12-27 17:38:52 +00:00
BoxedGen.cs 2005-04-04 Mike Kestner <mkestner@novell.com> 2005-04-04 16:27:08 +00:00
ByRefGen.cs 2004-12-26 Mike Kestner <mkestner@novell.com> 2004-12-26 21:22:50 +00:00
CallbackGen.cs 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 15:23:27 +00:00
ChildProperty.cs Redo child property handling; now we generate classes to hold 2004-11-18 20:31:22 +00:00
ClassBase.cs * parser/gapi2xml.pl (parseInitFunc): handle interface properties 2005-07-22 18:35:37 +00:00
ClassGen.cs * parser/gapi2xml.pl (parseInitFunc): handle interface properties 2005-07-22 18:35:37 +00:00
CodeGenerator.cs * generator/StructBase.cs: update field-generation logic a bit 2005-05-16 14:28:55 +00:00
ConstFilenameGen.cs 2005-06-02 Mike Kestner <mkestner@novell.com> 2005-06-02 14:16:52 +00:00
ConstStringGen.cs 2005-06-21 Mike Kestner <mkestner@novell.com> 2005-06-21 16:11:22 +00:00
Ctor.cs * glib/Value.cs: Obsolete the EnumWrapper and UnwrappedObject 2005-07-22 18:36:50 +00:00
DESIGN 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 15:23:27 +00:00
EnumGen.cs * parser/gapi2xml.pl: make note of _get_type methods for enums 2005-05-04 16:54:24 +00:00
FieldBase.cs * parser/gapi2xml.pl (parseInitFunc): handle interface properties 2005-07-22 18:35:37 +00:00
gapi2-codegen.in merge to HEAD of jeroen and friends' work on the 2-4 branch. HEAD 2004-10-29 20:33:07 +00:00
GenBase.cs 2004-12-27 Mike Kestner <mkestner@novell.com> 2004-12-27 21:32:08 +00:00
GenerationInfo.cs * generator/StructBase.cs: update field-generation logic a bit 2005-05-16 14:28:55 +00:00
HandleBase.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
IAccessor.cs 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 15:23:27 +00:00
IGeneratable.cs * generator/ManagedCallString.cs (Setup, Finish, ToString): Add 2004-12-16 23:38:35 +00:00
IManualMarshaler.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
ImportSignature.cs 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 14:55:08 +00:00
InterfaceGen.cs * parser/gapi2xml.pl (parseInitFunc): handle interface properties 2005-07-22 18:35:37 +00:00
LPGen.cs 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 15:23:27 +00:00
LPUGen.cs 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 15:23:27 +00:00
Makefile.am 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 15:23:27 +00:00
makefile.win32 2003-10-10 Mike Kestner <mkestner@ximian.com> 2003-10-10 18:58:19 +00:00
ManagedCallString.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
ManualGen.cs 2004-12-27 Mike Kestner <mkestner@novell.com> 2004-12-27 17:38:52 +00:00
MarshalGen.cs 2004-12-27 Mike Kestner <mkestner@novell.com> 2004-12-27 17:38:52 +00:00
Method.cs * parser/gapi2xml.pl (addParamsElem): change the handling of 2005-07-22 19:10:04 +00:00
MethodBase.cs 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 14:55:08 +00:00
MethodBody.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
ObjectBase.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
ObjectField.cs * generator/StructBase.cs: update field-generation logic a bit 2005-05-16 14:28:55 +00:00
ObjectGen.cs * parser/gapi2xml.pl (parseInitFunc): handle interface properties 2005-07-22 18:35:37 +00:00
OpaqueGen.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
Parameters.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
Parser.cs 2005-03-29 Mike Kestner <mkestner@novell.com> 2005-03-29 18:02:04 +00:00
Property.cs * glib/Value.cs: Obsolete the EnumWrapper and UnwrappedObject 2005-07-22 18:36:50 +00:00
PropertyBase.cs * parser/gapi2xml.pl (parseInitFunc): handle interface properties 2005-07-22 18:35:37 +00:00
ReturnValue.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
Signal.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
Signature.cs * generator/Parameters.cs (IsHidden): method to check if a 2005-05-02 20:10:03 +00:00
SimpleBase.cs 2005-06-08 Mike Kestner <mkestner@novell.com> 2005-06-09 14:27:48 +00:00
SimpleGen.cs 2004-12-26 Mike Kestner <mkestner@novell.com> 2004-12-26 21:22:50 +00:00
Statistics.cs 2004-06-25 Mike Kestner <mkestner@ximian.com> 2004-06-25 16:35:15 +00:00
StructBase.cs * generator/StructBase.cs: update field-generation logic a bit 2005-05-16 14:28:55 +00:00
StructField.cs 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-03 15:14:09 +00:00
StructGen.cs 2005-04-04 Mike Kestner <mkestner@novell.com> 2005-04-04 16:27:08 +00:00
SymbolTable.cs 2005-06-02 Mike Kestner <mkestner@novell.com> 2005-06-02 14:16:52 +00:00
VirtualMethod.cs 2005-07-02 Mike Kestner <mkestner@novell.com> 2005-07-02 14:55:08 +00:00
VMSignature.cs 2005-06-22 Mike Kestner <mkestner@novell.com> 2005-06-22 16:56:52 +00:00