Ryujinx-GtkSharp/glib
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
..
glue * glib/Value.cs: Obsolete the EnumWrapper and UnwrappedObject 2005-07-22 18:36:50 +00:00
Argv.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
Boxed.cs mark Boxed [Obsolete] 2004-10-21 01:08:10 +00:00
CDeclCallbackAttribute.cs 2005-03-23 Mike Kestner <mkestner@novell.com> 2005-03-23 20:35:15 +00:00
ClassInitializerAttribute.cs 2004-12-23 Mike Kestner <mkestner@novell.com> 2004-12-23 22:59:59 +00:00
ConnectBeforeAttribute.cs 2004-06-25 Mike Kestner <mkestner@ximian.com> 2004-06-25 18:42:19 +00:00
DefaultSignalHandlerAttribute.cs 2004-06-25 Mike Kestner <mkestner@ximian.com> 2004-06-25 18:42:19 +00:00
DelegateWrapper.cs 2005-03-25 Mike Kestner <mkestner@novell.com> 2005-03-25 17:57:15 +00:00
DestroyNotify.cs * generator/Parameters.cs (Parameters.Validate): If the parameters 2005-05-04 11:47:25 +00:00
EnumWrapper.cs * glib/Value.cs: Obsolete the EnumWrapper and UnwrappedObject 2005-07-22 18:36:50 +00:00
FileUtils.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
GException.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
glib-sharp.dll.config.in 2004-04-29 Mike Kestner <mkestner@ximian.com> 2004-04-29 15:00:24 +00:00
GString.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
GType.cs * glib/GType.cs (cctor): call g_type_init(). (Avoids debug spew 2005-06-06 15:09:07 +00:00
GTypeAttribute.cs * parser/gapi2xml.pl: make note of _get_type methods for enums 2005-05-04 16:54:24 +00:00
Idle.cs 2005-02-28 Mike Kestner <mkestner@novell.com> 2005-02-28 18:11:24 +00:00
IWrapper.cs 2004-06-25 Mike Kestner <mkestner@ximian.com> 2004-06-25 18:42:19 +00:00
List.cs 2005-06-23 Mike Kestner <mkestner@novell.com> 2005-06-23 22:28:06 +00:00
ListBase.cs 2005-06-23 Mike Kestner <mkestner@novell.com> 2005-06-23 22:28:06 +00:00
Log.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
MainContext.cs 2004-06-25 Mike Kestner <mkestner@ximian.com> 2004-06-25 18:42:19 +00:00
MainLoop.cs 2004-08-25 John Luke <john.luke@gmail.com> 2004-08-25 18:11:41 +00:00
Makefile.am * parser/gapi2xml.pl: make note of _get_type methods for enums 2005-05-04 16:54:24 +00:00
makefile.win32 2005-03-23 Mike Kestner <mkestner@novell.com> 2005-03-23 20:35:15 +00:00
ManagedValue.cs 2005-03-31 Mike Kestner <mkestner@novell.com> 2005-03-31 16:31:31 +00:00
Markup.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
Marshaller.cs * generator/Parameters.cs (AllowComplexRefs): new property for 2005-06-30 17:09:39 +00:00
MissingIntPtrCtorException.cs 2004-06-25 Mike Kestner <mkestner@ximian.com> 2004-06-25 18:42:19 +00:00
NotifyHandler.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
Object.cs 2005-05-31 Mike Kestner <mkestner@novell.com> 2005-05-31 19:22:58 +00:00
ObjectManager.cs * parser/gapi2xml.pl: make note of _get_type methods for enums 2005-05-04 16:54:24 +00:00
Opaque.cs Automatic memory management for opaque types [#49565] 2005-08-02 18:45:21 +00:00
PropertyAttribute.cs Redo child property handling; now we generate classes to hold 2004-11-18 20:31:22 +00:00
Signal.cs 2005-05-04 Mike Kestner <mkestner@novell.com> 2005-05-04 20:36:55 +00:00
SignalArgs.cs 2004-06-25 Mike Kestner <mkestner@ximian.com> 2004-06-25 18:42:19 +00:00
SignalAttribute.cs remove a bunch of doc comments 2004-07-09 15:25:39 +00:00
SignalCallback.cs 2005-03-08 Mike Kestner <mkestner@novell.com> 2005-03-08 21:28:08 +00:00
SList.cs 2005-06-23 Mike Kestner <mkestner@novell.com> 2005-06-23 22:28:06 +00:00
Source.cs 2005-02-28 Mike Kestner <mkestner@novell.com> 2005-02-28 18:11:24 +00:00
Thread.cs 2004-06-25 Mike Kestner <mkestner@ximian.com> 2004-06-25 18:42:19 +00:00
Timeout.cs 2005-02-28 Mike Kestner <mkestner@novell.com> 2005-02-28 18:11:24 +00:00
TypeConverter.cs * parser/gapi2xml.pl: make note of _get_type methods for enums 2005-05-04 16:54:24 +00:00
TypeFundamentals.cs remove a bunch of doc comments 2004-07-09 15:25:39 +00:00
UnwrappedObject.cs * glib/Value.cs: Obsolete the EnumWrapper and UnwrappedObject 2005-07-22 18:36:50 +00:00
Value.cs * glib/Value.cs: Obsolete the EnumWrapper and UnwrappedObject 2005-07-22 18:36:50 +00:00
ValueArray.cs 2004-12-07 Mike Kestner <mkestner@novell.com> 2004-12-07 19:03:55 +00:00
WeakObject.cs 2005-03-25 Mike Kestner <mkestner@novell.com> 2005-03-25 17:57:15 +00:00