Commit Graph

6 Commits

Author SHA1 Message Date
Christian Hoff
7b752d233c 2009-09-03 Christian Hoff <christian_hoff@gmx.net>
* glib/Global.cs: Kill the calling convention field again.
	It breaks GLib 2.x compatibility in the generator and there is
	probably no need to make the calling convention configurable.
	* .cs, *.custom: Hardcode Cdecl calling convention instead of
	using GLib's field.

svn path=/trunk/gtk-sharp/; revision=141283
2009-09-03 19:50:53 +00:00
Christian Hoff
58e97c087a 2009-09-02 Christian Hoff <christian_hoff@gmx.net>
* glib/Global.cs: Add a public constant field specifying the
	calling convention used by GLib and depending libraries.
	By now it's hardcoded to Cdecl as every non-Win32 runtime
	should ignore this attribute.
	* *.cs, *.custom: Use GLib.Global.CallingConvention for both
	pinvokes and callbacks. Plugs a stack leak on Win32. All
	pinvokes defaulted to StdCall and thus the stack was never
	cleaned up.

svn path=/trunk/gtk-sharp/; revision=141175
2009-09-02 20:17:37 +00:00
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
Dan Winship
b4a4db44dd * pango/Attribute.cs: Base class for Pango attributes, a la
Gdk.Event

	* pango/pango-symbols.xml: explain how to marshal PangoAttribute.

	* pango/AttrBackground.cs:
	* pango/AttrFallback.cs:
	* pango/AttrFamily.cs: 
	* pango/AttrFontDesc.cs:
	* pango/AttrForeground.cs:
	* pango/AttrLanguage.cs:
	* pango/AttrLetterSpacing.cs:
	* pango/AttrRise.cs:
	* pango/AttrScale.cs:
	* pango/AttrShape.cs:
	* pango/AttrSize.cs:
	* pango/AttrStretch.cs:
	* pango/AttrStrikethrough.cs:
	* pango/AttrStrikethroughColor.cs:
	* pango/AttrStyle.cs:
	* pango/AttrUnderline.cs:
	* pango/AttrUnderlineColor.cs:
	* pango/AttrVariant.cs:
	* pango/AttrWeight.cs: subclasses of Attribute, with proper
	constructors. These don't actually correspond one-to-one with
	the underlying types, but they're nicer this way.

	* pango/Pango.metadata: Hide Attribute and its subclasses from the
	generator. Also hide "Attr" (which previously contained
	non-working badly-named static methods to create Attributes)
	and AttrClass (which is not really useful outside of pango
	itself).

	* pango/AttrIterator.custom: use Pango.Attribute.GetAttribute.

	* pango/glue/attribute.c: glue for Attribute and its subclasses

	[Fixes #52575 and its semi-dup #46552]

svn path=/trunk/gtk-sharp/; revision=43520
2005-04-24 22:35:43 +00:00
Mike Kestner
7a6d6b2128 2004-06-25 Mike Kestner <mkestner@ximian.com>
* */*.cs : add lgpl license blurb and clean up (c)'s.
	* */*.custom : add lgpl license blurb and clean up (c)'s.
	* */glue/*.c : add lgpl license blurb and clean up (c)'s.
	file adds without license from now on are punishable by wedgie.

svn path=/trunk/gtk-sharp/; revision=30401
2004-06-25 18:42:19 +00:00
Mike Kestner
13f42d0b30 2004-02-24 Mike Kestner <mkestner@ximian.com>
* pango/AttrIterator.custom : manually implement SList method.
	* pango/GlyphItem.custom : manually implement SList method.
	* pango/Layout.custom : manually implement SList method.
	* pango/Pango.metadata : hide some SList methods.
	* pango/pango-api.xml : regen.

svn path=/trunk/gtk-sharp/; revision=23410
2004-02-24 18:00:40 +00:00