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
This commit is contained in:
Dan Winship 2005-08-02 18:45:21 +00:00
parent 4b3bdf71ce
commit eb4fdee774
33 changed files with 424 additions and 104 deletions

View file

@ -1,3 +1,81 @@
2005-07-29 Dan Winship <danw@novell.com>
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.
2005-08-01 Todd Berman <tberman@off.net>
* gtk/Gtk.metadata: Change the Gtk.Style.Paint* methods to use a

View file

@ -14,9 +14,16 @@
<attr path="//object[@cname='GdaExport']" name="hidden">1</attr>
<attr path="//object[@cname='GdaXmlDatabase']/signal[@name='Changed']" name="name">DataChanged</attr>
<attr path="//struct[@cname='GdaCommand']" name="opaque">1</attr>
<attr path="//struct[@cname='GdaCommand']/method[@name='Free']" name="deprecated">1</attr>
<attr path="//struct[@cname='GdaFieldAttributes']" name="opaque">1</attr>
<attr path="//struct[@cname='GdaFieldAttributes']/method[@name='Free']" name="deprecated">1</attr>
<attr path="//struct[@cname='GdaParameter']" name="opaque">1</attr>
<attr path="//struct[@cname='GdaParameter']/method[@name='Free']" name="deprecated">1</attr>
<attr path="//struct[@cname='GdaParameterList']/method[@name='Free']" name="deprecated">1</attr>
<attr path="//struct[@cname='GdaQuarkList']/method[@name='Free']" name="deprecated">1</attr>
<attr path="//struct[@cname='GdaRow']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='GdaValue']" name="opaque">1</attr>
<attr path="/api/namespace/struct[@cname='GdaValue']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='GdaValue']/method[@cname='gda_value_get_type']" name="name">GetGdaType</attr>
</metadata>

View file

@ -2167,7 +2167,7 @@
<field name="AutoIncrementStep" cname="auto_increment_step" type="glong" />
<field name="Position" cname="position" type="gint" />
<method name="Copy" cname="gda_field_attributes_copy">
<return-type type="GdaFieldAttributes*" />
<return-type type="GdaFieldAttributes*" owned="true" />
</method>
<method name="Free" cname="gda_field_attributes_free">
<return-type type="void" />
@ -2510,7 +2510,7 @@
</parameters>
</method>
<method name="Copy" cname="gda_value_copy">
<return-type type="GdaValue*" />
<return-type type="GdaValue*" owned="true" />
</method>
<method name="Free" cname="gda_value_free">
<return-type type="void" />

View file

@ -6,6 +6,8 @@
<attr path="/api/namespace/boxed[@cname='GdkColor']/method[@name='Parse']/return-type" name="type">gboolean</attr>
<attr path="/api/namespace/boxed[@cname='GdkColor']/method[@name='Parse']/*/*[@type='GdkColor*']" name="pass_as">ref</attr>
<attr path="/api/namespace/boxed[@cname='GdkCursor']" name="opaque">1</attr>
<attr path="/api/namespace/boxed[@cname='GdkCursor']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GdkCursor']/method[@name='Unref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GdkRectangle']/method[@name='Intersect']/*/*[@name='dest']" name="pass_as">out</attr>
<attr path="/api/namespace/boxed[@cname='GdkRectangle']/method[@name='Union']/*/*[@name='dest']" name="pass_as">out</attr>
<attr path="/api/namespace/callback[@cname='GdkPixbufDestroyNotify']/*/*[@type='guchar*']" name="array">1</attr>
@ -165,6 +167,7 @@
<attr path="/api/namespace/struct[@cname='GdkPixdata']/method[@name='ToCsource']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GdkPixmapObject']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']" name="opaque">1</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']/method[@name='Destroy']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']/method[@name='GetClipbox']/*/*[@name='rectangle']" name="pass_as">out</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']/method[@name='GetRectangles']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']/method[@name='Polygon']/*/*[@name='points']" name="array">1</attr>

View file

@ -2668,7 +2668,7 @@
</parameters>
</method>
<method name="Copy" cname="gdk_color_copy">
<return-type type="GdkColor*" />
<return-type type="GdkColor*" owned="true" />
</method>
<method name="Equal" cname="gdk_color_equal">
<return-type type="gboolean" />
@ -3098,7 +3098,7 @@
<field name="Rects" cname="rects" type="GdkRegionBox*" />
<field name="Extents" cname="extents" type="GdkRegionBox" />
<method name="Copy" cname="gdk_region_copy">
<return-type type="GdkRegion*" />
<return-type type="GdkRegion*" owned="true" />
</method>
<method name="Destroy" cname="gdk_region_destroy">
<return-type type="void" />
@ -3663,7 +3663,7 @@
</class>
<class name="Event" cname="GdkEvent_">
<method name="Copy" cname="gdk_event_copy" shared="true">
<return-type type="GdkEvent*" />
<return-type type="GdkEvent*" owned="true" />
<parameters>
<parameter type="GdkEvent*" name="event" />
</parameters>
@ -4534,7 +4534,7 @@
</parameters>
</method>
<method name="Copy" cname="gdk_pixbuf_copy">
<return-type type="GdkPixbuf*" />
<return-type type="GdkPixbuf*" owned="true" />
</method>
<method name="CopyArea" cname="gdk_pixbuf_copy_area">
<return-type type="void" />

View file

@ -2802,7 +2802,7 @@
</parameters>
</method>
<method name="Copy" cname="gdk_color_copy">
<return-type type="GdkColor*" />
<return-type type="GdkColor*" owned="true" />
</method>
<method name="Equal" cname="gdk_color_equal">
<return-type type="gboolean" />
@ -3242,7 +3242,7 @@
<field name="Rects" cname="rects" type="GdkRegionBox*" />
<field name="Extents" cname="extents" type="GdkRegionBox" />
<method name="Copy" cname="gdk_region_copy">
<return-type type="GdkRegion*" />
<return-type type="GdkRegion*" owned="true" />
</method>
<method name="Destroy" cname="gdk_region_destroy">
<return-type type="void" />
@ -3831,7 +3831,7 @@
</class>
<class name="Event" cname="GdkEvent_">
<method name="Copy" cname="gdk_event_copy" shared="true">
<return-type type="GdkEvent*" />
<return-type type="GdkEvent*" owned="true" />
<parameters>
<parameter type="GdkEvent*" name="event" />
</parameters>
@ -4730,7 +4730,7 @@
</parameters>
</method>
<method name="Copy" cname="gdk_pixbuf_copy">
<return-type type="GdkPixbuf*" />
<return-type type="GdkPixbuf*" owned="true" />
</method>
<method name="CopyArea" cname="gdk_pixbuf_copy_area">
<return-type type="void" />

View file

@ -51,10 +51,27 @@ namespace GtkSharp.Generation {
return "Handle";
}
public abstract string FromNative (string var, bool owned);
public override string FromNative (string var)
{
return FromNative (var, false);
}
public string FromNativeReturn (string var, bool owned)
{
return FromNative (var, owned);
}
public override string FromNativeReturn (string var)
{
return FromNativeReturn (var, false);
}
public void WriteAccessors (StreamWriter sw, string indent, string var)
{
sw.WriteLine (indent + "get {");
sw.WriteLine (indent + "\treturn " + FromNative (var) + ";");
sw.WriteLine (indent + "\treturn " + FromNative (var, false) + ";");
sw.WriteLine (indent + "}");
sw.WriteLine (indent + "set {");
sw.WriteLine (indent + "\t" + var + " = " + CallByName ("value") + ";");

View file

@ -40,7 +40,7 @@ namespace GtkSharp.Generation {
IGeneratable igen = p.Generatable;
if ((igen is StructGen || p.PassAs != "") &&
(p.Name != igen.FromNative (p.Name)))
(p.Name != p.FromNative (p.Name)))
this.special.Add (true);
else
this.special.Add (false);
@ -60,7 +60,7 @@ namespace GtkSharp.Generation {
ret += indent + igen.QualifiedName + " my" + p.Name;
if (igen is StructGen || p.PassAs == "ref")
ret += " = " + igen.FromNative (p.Name);
ret += " = " + p.FromNative (p.Name);
ret += ";\n";
}
@ -76,9 +76,8 @@ namespace GtkSharp.Generation {
for (int i = 0; i < parms.Count; i ++) {
Parameter p = parms [i] as Parameter;
IGeneratable igen = p.Generatable;
result [i] = p.PassAs == "" ? "" : p.PassAs + " ";
result [i] += ((bool)special[i]) ? "my" + p.Name : igen.FromNative (p.Name);
result [i] += ((bool)special[i]) ? "my" + p.Name : p.FromNative (p.Name);
}
return String.Join (", ", result);

View file

@ -183,7 +183,7 @@ namespace GtkSharp.Generation {
IGeneratable gen = p.Generatable;
if (p.PassAs == "out" && p.CSType != p.MarshalType && !(gen is StructBase || gen is ByRefGen))
sw.WriteLine(indent + "\t\t\t" + p.Name + " = " + gen.FromNative (p.Name + "_as_native") + ";");
sw.WriteLine(indent + "\t\t\t" + p.Name + " = " + p.FromNative (p.Name + "_as_native") + ";");
else if (p.IsArray && gen is IManualMarshaler) {
sw.WriteLine(indent + "\t\t\tfor (int i = 0; i < native_" + p.Name + ".Length; i++)");
sw.WriteLine(indent + "\t\t\t\t" + (gen as IManualMarshaler).ReleaseNative ("native_" + p.Name + "[i]") + ";");

View file

@ -28,9 +28,9 @@ namespace GtkSharp.Generation {
protected ObjectBase (XmlElement ns, XmlElement elem) : base (ns, elem) {}
public override string FromNative(string var)
public override string FromNative (string var, bool owned)
{
return "GLib.Object.GetObject(" + var + ") as " + QualifiedName;
return "GLib.Object.GetObject(" + var + (owned ? ", true" : "") + ") as " + QualifiedName;
}
}
}

View file

@ -30,9 +30,9 @@ namespace GtkSharp.Generation {
public OpaqueGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
public override string FromNative(string var)
public override string FromNative(string var, bool owned)
{
return var + " == IntPtr.Zero ? null : new " + QualifiedName + "(" + var + ")";
return var + " == IntPtr.Zero ? null : (" + QualifiedName + ") GLib.Opaque.GetOpaque (" + var + ", typeof (" + QualifiedName + "), " + (owned ? "true" : "false") + ")";
}
private bool DisableRawCtor {
@ -58,6 +58,9 @@ namespace GtkSharp.Generation {
SymbolTable table = SymbolTable.Table;
Method ref_, unref, dispose;
GetSpecialMethods (out ref_, out unref, out dispose);
sw.Write ("\tpublic class " + Name);
string cs_parent = table.GetCSType(Elem.GetAttribute("parent"));
if (cs_parent != "")
@ -70,6 +73,54 @@ namespace GtkSharp.Generation {
GenFields (gen_info);
GenMethods (gen_info, null, null);
GenCtors (gen_info);
if (ref_ != null) {
ref_.GenerateImport (sw);
sw.WriteLine ("\t\tprotected override void Ref (IntPtr raw)");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\t" + ref_.CName + " (raw);");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
if (ref_.IsDeprecated) {
sw.WriteLine ("\t\t[Obsolete(\"" + QualifiedName + " is now refcounted automatically\")]");
if (ref_.ReturnType == "void")
sw.WriteLine ("\t\tpublic void Ref () {}");
else
sw.WriteLine ("\t\tpublic " + Name + " Ref () { return this; }");
sw.WriteLine ();
}
}
if (unref != null) {
unref.GenerateImport (sw);
sw.WriteLine ("\t\tprotected override void Unref (IntPtr raw)");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\t" + unref.CName + " (raw);");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
if (unref.IsDeprecated) {
sw.WriteLine ("\t\t[Obsolete(\"" + QualifiedName + " is now refcounted automatically\")]");
sw.WriteLine ("\t\tpublic void Unref () {}");
sw.WriteLine ();
}
}
if (dispose != null) {
dispose.GenerateImport (sw);
sw.WriteLine ("\t\tprotected override void Free (IntPtr raw)");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\t" + dispose.CName + " (raw);");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
if (dispose.IsDeprecated) {
sw.WriteLine ("\t\t[Obsolete(\"" + QualifiedName + " is now freed automatically\")]");
sw.WriteLine ("\t\tpublic void " + dispose.Name + " () {}");
sw.WriteLine ();
}
}
sw.WriteLine ("#endregion");
AppendCustom(sw, gen_info.CustomDir);
@ -82,6 +133,34 @@ namespace GtkSharp.Generation {
Statistics.OpaqueCount++;
}
void GetSpecialMethods (out Method ref_, out Method unref, out Method dispose)
{
ref_ = CheckSpecialMethod (GetMethod ("Ref"));
unref = CheckSpecialMethod (GetMethod ("Unref"));
dispose = GetMethod ("Free");
if (dispose == null) {
dispose = GetMethod ("Destroy");
if (dispose == null)
dispose = GetMethod ("Dispose");
}
dispose = CheckSpecialMethod (dispose);
}
Method CheckSpecialMethod (Method method)
{
if (method == null)
return null;
if (method.ReturnType != "void" &&
method.ReturnType != QualifiedName)
return null;
if (method.Signature.ToString () != "")
return null;
methods.Remove (method.Name);
return method;
}
protected override void GenCtors (GenerationInfo gen_info)
{
if (!DisableRawCtor) {

View file

@ -161,6 +161,12 @@ namespace GtkSharp.Generation {
}
}
public bool Owned {
get {
return elem.GetAttribute ("owned") == "true";
}
}
public string PropertyName {
get {
return elem.GetAttribute("property_name");
@ -206,7 +212,14 @@ namespace GtkSharp.Generation {
call_parm = call_parm.Replace ("ref ", "");
return call_parm;
}
public string FromNative (string var)
{
if (Generatable is HandleBase)
return ((HandleBase)Generatable).FromNative (var, Owned);
else
return Generatable.FromNative (var);
}
public string StudlyName {

View file

@ -131,9 +131,10 @@ namespace GtkSharp.Generation {
string type_str = "typeof (" + ElementType + ")";
string args = type_str + ", " + (Owned ? "true" : "false") + ", " + (ElementsOwned ? "true" : "false");
return String.Format ("({0}[]) GLib.Marshaller.ListToArray ({1}, {2})", ElementType, IGen.FromNativeReturn (var + ", " + args), type_str);
} else if (Owned)
var += ", true";
return IGen.FromNativeReturn (var);
} else if (IGen is HandleBase)
return ((HandleBase)IGen).FromNative (var, Owned);
else
return IGen.FromNativeReturn (var);
}
public bool Validate ()

View file

@ -213,10 +213,10 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\t\tif (arg{0} == IntPtr.Zero)", idx);
sw.WriteLine("\t\t\t\targs.Args[{0}] = null;", idx - 1);
sw.WriteLine("\t\t\telse {");
sw.WriteLine("\t\t\t\targs.Args[" + (idx - 1) + "] = " + igen.FromNative ("arg" + idx) + ";");
sw.WriteLine("\t\t\t\targs.Args[" + (idx - 1) + "] = " + p.FromNative ("arg" + idx) + ";");
sw.WriteLine("\t\t\t}");
} else
sw.WriteLine("\t\t\targs.Args[" + (idx - 1) + "] = " + igen.FromNative ("arg" + idx) + ";");
sw.WriteLine("\t\t\targs.Args[" + (idx - 1) + "] = " + p.FromNative ("arg" + idx) + ";");
}
if (p.PassAs != "")
finish += "\t\t\targ" + idx + " = " + igen.ToNativeReturn ("((" + p.CSType + ")args.Args[" + (idx - 1) + "])") + ";\n";
@ -316,7 +316,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + p.MarshalType + ")));");
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (" + p.Name + "_ptr);");
cleanup += "\t\t\t" + p.Name + " = " + p.Generatable.FromNative ("(" + p.MarshalType + ") Marshal.PtrToStructure (" + p.Name + "_ptr, typeof (" + p.MarshalType + "))") + ";\n";
cleanup += "\t\t\t" + p.Name + " = " + p.FromNative ("(" + p.MarshalType + ") Marshal.PtrToStructure (" + p.Name + "_ptr, typeof (" + p.MarshalType + "))") + ";\n";
cleanup += "\t\t\tMarshal.FreeHGlobal (" + p.Name + "_ptr);\n";
}
} else if (p.IsLength && parms [i - 1].IsString)

View file

@ -31,25 +31,53 @@ namespace GLib {
using System.ComponentModel;
using System.Runtime.InteropServices;
public class Opaque : IWrapper {
public class Opaque : IWrapper, IDisposable {
IntPtr _obj;
bool owned;
// We don't have to do as much work here as GLib.Object.GetObject
// does; users can't subclass opaque types, so nothing bad will happen
// if we accidentally end up creating two wrappers for the same object.
static Hashtable Opaques = new Hashtable();
public static Opaque GetOpaque(IntPtr o)
public static Opaque GetOpaque (IntPtr o)
{
WeakReference reference = (WeakReference) Opaques[(int)o];
if (reference == null || !reference.IsAlive)
WeakReference reference = (WeakReference) Opaques[o];
if (reference == null)
return null;
if (!reference.IsAlive) {
Opaques.Remove (o);
return null;
}
return (Opaque) reference.Target;
}
public Opaque () {}
public static Opaque GetOpaque (IntPtr o, Type type, bool owned)
{
Opaque opaque = GetOpaque (o);
if (opaque != null) {
if (owned)
opaque.owned = true;
return opaque;
}
opaque = (Opaque)Activator.CreateInstance (type, new object[] { o });
opaque.owned = owned;
return opaque;
}
public Opaque ()
{
owned = true;
}
public Opaque (IntPtr raw)
{
Raw = raw;
owned = false;
}
protected IntPtr Raw {
@ -57,17 +85,53 @@ namespace GLib {
return _obj;
}
set {
Opaques [value] = new WeakReference (this);
if (_obj != IntPtr.Zero) {
Opaques.Remove (_obj);
Unref (_obj);
if (owned)
Free (_obj);
}
_obj = value;
if (_obj != IntPtr.Zero) {
Ref (_obj);
Opaques [_obj] = new WeakReference (this);
}
}
}
~Opaque ()
{
Dispose ();
}
public virtual void Dispose ()
{
Raw = IntPtr.Zero;
GC.SuppressFinalize (this);
}
// These take an IntPtr arg so we don't get conflicts if we need
// to have an "[Obsolete] public void Ref ()"
protected virtual void Ref (IntPtr raw) {}
protected virtual void Unref (IntPtr raw) {}
protected virtual void Free (IntPtr raw) {}
public IntPtr Handle {
get {
return _obj;
}
}
public bool Owned {
get {
return owned;
}
set {
owned = value;
}
}
public override bool Equals (object o)
{
if (!(o is Opaque))

View file

@ -18,7 +18,11 @@
<attr path="/api/namespace/object[@cname='GnomeDateEdit']/constructor[@cname='gnome_date_edit_new']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GnomeDateEdit']/method[@name='GetFlags']" name="new_flag">1</attr>
<attr path="/api/namespace/boxed[@cname='GnomeCanvasPoints']" name="opaque">1</attr>
<attr path="/api/namespace/boxed[@cname='GnomeCanvasPoints']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GnomeCanvasPoints']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GnomeGlyphList']/method/*/*[@type='const-guchar*']" name="type">const-gchar*</attr>
<attr path="/api/namespace/boxed[@cname='GnomeGlyphList']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GnomeGlyphList']/method[@name='Unref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GnomeModuleInfo']" name="opaque">1</attr>
<attr path="/api/namespace/boxed[@cname='GnomeModuleInfo']/field[@name='Name']" name="access">public</attr>
<attr path="/api/namespace/boxed[@cname='GnomeModuleInfo']/field[@name='Version']" name="access">public</attr>
@ -151,9 +155,12 @@
<attr path="/api/namespace/struct[@cname='GnomeCanvasPathDef']/method[@name='Lineto']" name="name">LineTo</attr>
<attr path="/api/namespace/struct[@cname='GnomeCanvasPathDef']/method[@name='LinetoMoving']" name="name">LineToMoving</attr>
<attr path="/api/namespace/struct[@cname='GnomeCanvasPathDef']/method[@name='Moveto']" name="name">MoveTo</attr>
<attr path="/api/namespace/struct[@cname='GnomeCanvasPathDef']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeCanvasPathDef']/method[@name='Split']/return-type" name="element_type">GnomeCanvasPathDef*</attr>
<attr path="/api/namespace/struct[@cname='GnomeCanvasPathDef']/method[@name='Split']/return-type" name="owned">true</attr>
<attr path="/api/namespace/struct[@cname='GnomeCanvasPathDef']/method[@name='Split']/return-type" name="elements_owned">true</attr>
<attr path="/api/namespace/struct[@cname='GnomeCanvasPathDef']/method[@name='Unref']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeModuleRequirement']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GnomePrintPaper']/method/*/*[@type='const-guchar*']" name="type">const-gchar*</attr>
<attr path="/api/namespace/struct[@cname='GnomeThemeFile']/method[@name='Free']" name="deprecated">1</attr>
</metadata>

View file

@ -76,6 +76,7 @@
<attr path="/api/namespace/struct[@cname='GnomeVFSAsyncHandle']" name="opaque">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSCancellation']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSContext']" name="opaque">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSContext']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSDirectoryHandle']" name="hidden">1</attr>
<remove-node path="/api/namespace/struct[@cname='GnomeVFSFileInfo']" />
<attr path="/api/namespace/struct[@cname='GnomeVFSFindDirectoryResult']" name="hidden">1</attr>
@ -118,8 +119,6 @@
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='ListParse']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='ListRef']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='ListUnref']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='Ref']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSURI']/method[@name='Unref']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSUnixMount']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GnomeVFSUnixMountPoint']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='XdgGlobHash']" name="hidden">1</attr>

View file

@ -985,7 +985,7 @@
<field name="Reserved1" cname="reserved1" type="void*" />
<field name="Reserved2" cname="reserved2" type="void*" />
<method name="Copy" cname="gnome_vfs_mime_application_copy">
<return-type type="GnomeVFSMimeApplication*" />
<return-type type="GnomeVFSMimeApplication*" owned="true" />
</method>
<method name="Free" cname="gnome_vfs_mime_application_free">
<return-type type="void" />

View file

@ -10,13 +10,18 @@
<attr path="/api/namespace/struct[@cname='GtkToggleActionEntry']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTypeInfo']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkBorder']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkIconInfo']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkIconSet']/method[@name='GetSizes']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkIconSet']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkIconSet']/method[@name='Unref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkIconSource']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']" name="opaque">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/field[@name='Length']" name="access">public</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/field[@name='Format']" name="access">public</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/field[@name='Selection']" name="access">public</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/field[@name='Target']" name="access">public</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/field[@name='Type']" name="access">public</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/method[@name='GetTargets']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/method[@name='GetText']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/method[@name='SetText']" name="hidden">1</attr>
@ -32,6 +37,9 @@
<attr path="/api/namespace/boxed[@cname='GtkTextIter']/method[@name='GetToggledTags']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkTreePath']/constructor[@cname='gtk_tree_path_new_from_indices']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkTreePath']/method[@name='GetIndices']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkTreePath']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkTreeRowReference']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkTreeRowReference']/method[@name='GetPath']/return-type" name="owned">true</attr>
<attr path="/api/namespace/callback[@cname='GtkItemFactoryCallback2']" name="hidden">1</attr>
<attr path="/api/namespace/callback[@cname='GtkModuleDisplayInitFunc']" name="hidden">1</attr>
<attr path="/api/namespace/callback[@cname='GtkModuleInitFunc']" name="hidden">1</attr>
@ -85,6 +93,7 @@
<attr path="/api/namespace/class[@cname='GtkTimeout_']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GtkTree_']/method[@name='GetRowDragData']/*/*[@name='tree_model']" name="pass_as">out</attr>
<attr path="/api/namespace/class[@cname='GtkTree_']/method[@name='GetRowDragData']/*/*[@name='path']" name="pass_as">out</attr>
<attr path="/api/namespace/class[@cname='GtkTree_']/method[@name='GetRowDragData']/*/*[@name='path']" name="owned">true</attr>
<attr path="/api/namespace/class[@cname='GtkType_']" name="hidden">1</attr>
<attr path="/api/namespace/enum[@cname='GtkArgFlags']" name="hidden">1</attr>
<attr path="/api/namespace/enum[@cname='GtkDebugFlag']" name="hidden">1</attr>
@ -129,6 +138,7 @@
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='Get']" name="hidden">1</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='GetIterFromString']/*/*[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='GetIter']/*/*[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='GetPath']/return-type" name="owned">true</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='GetValue']/*/*[@name='value']" name="pass_as">ref</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='IterChildren']/*/*[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='IterNext']/*/*[@name='iter']" name="pass_as">ref</attr>
@ -211,6 +221,7 @@
<attr path="/api/namespace/object[@cname='GtkCheckMenuItem']/method[@name='Toggled']" name="name">EmitToggled</attr>
<attr path="/api/namespace/object[@cname='GtkClipboard']/method[@name='SetWithData']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkClipboard']/method[@name='SetWithOwner']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkClipboard']/method[@name='WaitForContents']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkColorButton']/method[@name='GetColor']/*/*[@name='color']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkColorSelection']/method[@name='GetColor']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkColorSelection']/method[@name='GetCurrentColor']/*/*[@name='color']" name="pass_as">out</attr>
@ -299,8 +310,13 @@
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='GetIconSizes']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='GetSearchPath']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='ListIcons']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='LookupIcon']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='SetSearchPath']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/method[@name='ItemActivated']" name="name">ActivateItem</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/method[@name='GetPathAtPos']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/method[@name='GetSelectedItems']/return-type" name="element_type">GtkTreePath*</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/method[@name='GetSelectedItems']/return-type" name="elements_owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/method[@name='GetSelectedItems']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/signal[@name='SelectAll']" name="name">AllSelected</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/signal[@name='SetScrollAdjustments']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconView']/signal[@name='UnselectAll']" name="name">AllUnselected</attr>
@ -494,10 +510,14 @@
<attr path="/api/namespace/object[@cname='GtkToolItem']/signal[@name='SetTooltip']" name="name">TooltipSet</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelFilter']/method[@name='ConvertIterToChildIter']/*/*[@name='child_iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelFilter']/method[@name='ConvertChildIterToIter']/*/*[@name='filter_iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelFilter']/method[@name='ConvertChildPathToPath']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelFilter']/method[@name='ConvertPathToChildPath']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelFilter']/method[@name='SetModifyFunc']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelSort']/constructor[@cname='gtk_tree_model_sort_new_with_model']/*/*[@name='child_model']" name="property_name">model</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelSort']/method[@name='ConvertChildIterToIter']/*/*[@name='sort_iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelSort']/method[@name='ConvertIterToChildIter']/*/*[@name='child_iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelSort']/method[@name='ConvertChildPathToPath']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelSort']/method[@name='ConvertPathToChildPath']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTreeSelection']/method[@name='GetSelected']/*/*" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeSelection']/method[@name='GetSelectedRows']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeSelection']/method[@name='SelectedForeach']/*/*[@name='func']" name="scope">call</attr>
@ -526,9 +546,12 @@
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetColumns']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetCursor']/*/*[@name='focus_column']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetCursor']/*/*[@name='path']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetCursor']/*/*[@name='path']" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDestRowAtPos']/*/*[@name='path']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDestRowAtPos']/*/*[@name='path']" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDestRowAtPos']/*/*[@name='pos']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDragDestRow']/*/*[@name='path']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDragDestRow']/*/*[@name='path']" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDragDestRow']/*/*[@name='pos']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetBackgroundArea']/*/*[@name='rect']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetPathAtPos']" name="hidden">1</attr>
@ -636,12 +659,9 @@
<attr path="/api/namespace/struct[@cname='GtkTableRowCol']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTargetEntry']/field[@cname='flags']" name="type">GtkTargetFlags</attr>
<attr path="/api/namespace/struct[@cname='GtkTargetList']" name="opaque">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTargetList']" name="disable_raw_ctor">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTargetList']/constructor[@cname='gtk_target_list_new']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTargetList']/method[@name='AddTable']/*/*[@name='targets']" name="array">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTargetList']/method[@name='AddTable']/*/*[@name='ntargets']" name="name">n_targets</attr>
<attr path="/api/namespace/struct[@cname='GtkTargetList']/method[@name='Ref']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTargetList']/method[@name='Unref']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTextAppearance']/field[@cname='underline']" name="type">PangoUnderline</attr>
<attr path="/api/namespace/struct[@cname='GtkTextAppearance']/field[@cname='draw_bg']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkTextAppearance']/field[@cname='inside_selection']" name="hidden">1</attr>

View file

@ -451,6 +451,8 @@ namespace Gtk {
idx = Nodes.IndexOf (node);
if (idx < 0) throw new Exception ("Node not found in Nodes list");
path.PrependIndex (idx);
path.Owned = false;
return path;
}

View file

@ -16,20 +16,6 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_target_list_ref(IntPtr raw);
public TargetList(IntPtr raw) : base(raw) {
gtk_target_list_ref(raw);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_target_list_unref(IntPtr raw);
~TargetList() {
gtk_target_list_unref(Handle);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_target_list_new(Gtk.TargetEntry[] targets, uint n_targets);

View file

@ -82,6 +82,7 @@
if (raw_ret) {
column = (Gtk.TreeViewColumn) GLib.Object.GetObject (columnHandle, false);
path = new TreePath (pathHandle);
path.Owned = true;
} else {
path = null;
column = null;
@ -96,9 +97,10 @@
IntPtr pathHandle;
IntPtr columnHandle;
bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, out columnHandle, IntPtr.Zero, IntPtr.Zero);
if (raw_ret)
if (raw_ret) {
path = new TreePath (pathHandle);
else
path.Owned = true;
} else
path = null;
return raw_ret;
@ -111,6 +113,7 @@
bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, out columnHandle, IntPtr.Zero, IntPtr.Zero);
if (raw_ret) {
path = new TreePath (pathHandle);
path.Owned = true;
column = (Gtk.TreeViewColumn) GLib.Object.GetObject (columnHandle, false);
} else {
path = null;

View file

@ -8488,7 +8488,7 @@
</parameters>
</virtual_method>
<method name="Copy" cname="gtk_rc_style_copy">
<return-type type="GtkRcStyle*" />
<return-type type="GtkRcStyle*" owned="true" />
</method>
<method name="GetType" cname="gtk_rc_style_get_type" shared="true">
<return-type type="GType" />
@ -9602,7 +9602,7 @@
</parameters>
</method>
<method name="Copy" cname="gtk_style_copy">
<return-type type="GtkStyle*" />
<return-type type="GtkStyle*" owned="true" />
</method>
<method name="Detach" cname="gtk_style_detach">
<return-type type="void" />
@ -14890,7 +14890,7 @@
<field name="Top" cname="top" type="gint" />
<field name="Bottom" cname="bottom" type="gint" />
<method name="Copy" cname="gtk_border_copy">
<return-type type="GtkBorder*" />
<return-type type="GtkBorder*" owned="true" />
</method>
<method name="Free" cname="gtk_border_free">
<return-type type="void" />
@ -14932,7 +14932,7 @@
</struct>
<boxed name="IconInfo" cname="GtkIconInfo" opaque="true">
<method name="Copy" cname="gtk_icon_info_copy">
<return-type type="GtkIconInfo*" />
<return-type type="GtkIconInfo*" owned="true" />
</method>
<method name="Free" cname="gtk_icon_info_free">
<return-type type="void" />
@ -14986,7 +14986,7 @@
</parameters>
</method>
<method name="Copy" cname="gtk_icon_set_copy">
<return-type type="GtkIconSet*" />
<return-type type="GtkIconSet*" owned="true" />
</method>
<method name="GetSizes" cname="gtk_icon_set_get_sizes">
<return-type type="void" />
@ -15024,7 +15024,7 @@
</boxed>
<boxed name="IconSource" cname="GtkIconSource" opaque="true">
<method name="Copy" cname="gtk_icon_source_copy">
<return-type type="GtkIconSource*" />
<return-type type="GtkIconSource*" owned="true" />
</method>
<method name="Free" cname="gtk_icon_source_free">
<return-type type="void" />
@ -15227,7 +15227,7 @@
<field name="Width" cname="width" type="gint" />
<field name="Height" cname="height" type="gint" />
<method name="Copy" cname="gtk_requisition_copy">
<return-type type="GtkRequisition*" />
<return-type type="GtkRequisition*" owned="true" />
</method>
<method name="Free" cname="gtk_requisition_free">
<return-type type="void" />
@ -15252,7 +15252,7 @@
<field name="Length" cname="length" type="gint" />
<field name="Display" cname="display" type="GdkDisplay*" />
<method name="Copy" cname="gtk_selection_data_copy">
<return-type type="GtkSelectionData*" />
<return-type type="GtkSelectionData*" owned="true" />
</method>
<method name="Free" cname="gtk_selection_data_free">
<return-type type="void" />
@ -15303,7 +15303,7 @@
<field name="Keyval" cname="keyval" type="guint" />
<field name="TranslationDomain" cname="translation_domain" type="gchar*" />
<method name="Copy" cname="gtk_stock_item_copy">
<return-type type="GtkStockItem*" />
<return-type type="GtkStockItem*" owned="true" />
</method>
<method name="Free" cname="gtk_stock_item_free">
<return-type type="void" />
@ -15431,7 +15431,7 @@
<field name="Pad3" cname="pad3" bits="1" type="guint" access="private" />
<field name="Pad4" cname="pad4" bits="1" type="guint" access="private" />
<method name="Copy" cname="gtk_text_attributes_copy">
<return-type type="GtkTextAttributes*" />
<return-type type="GtkTextAttributes*" owned="true" />
</method>
<method name="CopyValues" cname="gtk_text_attributes_copy_values">
<return-type type="void" />
@ -15572,7 +15572,7 @@
</parameters>
</method>
<method name="Copy" cname="gtk_text_iter_copy">
<return-type type="GtkTextIter*" />
<return-type type="GtkTextIter*" owned="true" />
</method>
<method name="Editable" cname="gtk_text_iter_editable">
<return-type type="gboolean" />
@ -15904,7 +15904,7 @@
<field name="UserData2" cname="user_data2" type="gpointer" />
<field name="UserData3" cname="user_data3" type="gpointer" />
<method name="Copy" cname="gtk_tree_iter_copy">
<return-type type="GtkTreeIter*" />
<return-type type="GtkTreeIter*" owned="true" />
</method>
<method name="Free" cname="gtk_tree_iter_free">
<return-type type="void" />
@ -15927,7 +15927,7 @@
</parameters>
</method>
<method name="Copy" cname="gtk_tree_path_copy">
<return-type type="GtkTreePath*" />
<return-type type="GtkTreePath*" owned="true" />
</method>
<method name="Down" cname="gtk_tree_path_down">
<return-type type="void" />
@ -15990,7 +15990,7 @@
</boxed>
<boxed name="TreeRowReference" cname="GtkTreeRowReference" opaque="true">
<method name="Copy" cname="gtk_tree_row_reference_copy">
<return-type type="GtkTreeRowReference*" />
<return-type type="GtkTreeRowReference*" owned="true" />
</method>
<method name="Deleted" cname="gtk_tree_row_reference_deleted" shared="true">
<return-type type="void" />

View file

@ -9356,7 +9356,7 @@
</parameters>
</virtual_method>
<method name="Copy" cname="gtk_rc_style_copy">
<return-type type="GtkRcStyle*" />
<return-type type="GtkRcStyle*" owned="true" />
</method>
<method name="GetType" cname="gtk_rc_style_get_type" shared="true">
<return-type type="GType" />
@ -10470,7 +10470,7 @@
</parameters>
</method>
<method name="Copy" cname="gtk_style_copy">
<return-type type="GtkStyle*" />
<return-type type="GtkStyle*" owned="true" />
</method>
<method name="Detach" cname="gtk_style_detach">
<return-type type="void" />
@ -15865,7 +15865,7 @@
<field name="Top" cname="top" type="gint" />
<field name="Bottom" cname="bottom" type="gint" />
<method name="Copy" cname="gtk_border_copy">
<return-type type="GtkBorder*" />
<return-type type="GtkBorder*" owned="true" />
</method>
<method name="Free" cname="gtk_border_free">
<return-type type="void" />
@ -15907,7 +15907,7 @@
</struct>
<boxed name="IconInfo" cname="GtkIconInfo" opaque="true">
<method name="Copy" cname="gtk_icon_info_copy">
<return-type type="GtkIconInfo*" />
<return-type type="GtkIconInfo*" owned="true" />
</method>
<method name="Free" cname="gtk_icon_info_free">
<return-type type="void" />
@ -15961,7 +15961,7 @@
</parameters>
</method>
<method name="Copy" cname="gtk_icon_set_copy">
<return-type type="GtkIconSet*" />
<return-type type="GtkIconSet*" owned="true" />
</method>
<method name="GetSizes" cname="gtk_icon_set_get_sizes">
<return-type type="void" />
@ -15999,7 +15999,7 @@
</boxed>
<boxed name="IconSource" cname="GtkIconSource" opaque="true">
<method name="Copy" cname="gtk_icon_source_copy">
<return-type type="GtkIconSource*" />
<return-type type="GtkIconSource*" owned="true" />
</method>
<method name="Free" cname="gtk_icon_source_free">
<return-type type="void" />
@ -16208,7 +16208,7 @@
<field name="Width" cname="width" type="gint" />
<field name="Height" cname="height" type="gint" />
<method name="Copy" cname="gtk_requisition_copy">
<return-type type="GtkRequisition*" />
<return-type type="GtkRequisition*" owned="true" />
</method>
<method name="Free" cname="gtk_requisition_free">
<return-type type="void" />
@ -16233,7 +16233,7 @@
<field name="Length" cname="length" type="gint" />
<field name="Display" cname="display" type="GdkDisplay*" />
<method name="Copy" cname="gtk_selection_data_copy">
<return-type type="GtkSelectionData*" />
<return-type type="GtkSelectionData*" owned="true" />
</method>
<method name="Free" cname="gtk_selection_data_free">
<return-type type="void" />
@ -16308,7 +16308,7 @@
<field name="Keyval" cname="keyval" type="guint" />
<field name="TranslationDomain" cname="translation_domain" type="gchar*" />
<method name="Copy" cname="gtk_stock_item_copy">
<return-type type="GtkStockItem*" />
<return-type type="GtkStockItem*" owned="true" />
</method>
<method name="Free" cname="gtk_stock_item_free">
<return-type type="void" />
@ -16455,7 +16455,7 @@
<field name="Pad3" cname="pad3" bits="1" type="guint" access="private" />
<field name="Pad4" cname="pad4" bits="1" type="guint" access="private" />
<method name="Copy" cname="gtk_text_attributes_copy">
<return-type type="GtkTextAttributes*" />
<return-type type="GtkTextAttributes*" owned="true" />
</method>
<method name="CopyValues" cname="gtk_text_attributes_copy_values">
<return-type type="void" />
@ -16596,7 +16596,7 @@
</parameters>
</method>
<method name="Copy" cname="gtk_text_iter_copy">
<return-type type="GtkTextIter*" />
<return-type type="GtkTextIter*" owned="true" />
</method>
<method name="Editable" cname="gtk_text_iter_editable">
<return-type type="gboolean" />
@ -16928,7 +16928,7 @@
<field name="UserData2" cname="user_data2" type="gpointer" />
<field name="UserData3" cname="user_data3" type="gpointer" />
<method name="Copy" cname="gtk_tree_iter_copy">
<return-type type="GtkTreeIter*" />
<return-type type="GtkTreeIter*" owned="true" />
</method>
<method name="Free" cname="gtk_tree_iter_free">
<return-type type="void" />
@ -16951,7 +16951,7 @@
</parameters>
</method>
<method name="Copy" cname="gtk_tree_path_copy">
<return-type type="GtkTreePath*" />
<return-type type="GtkTreePath*" owned="true" />
</method>
<method name="Down" cname="gtk_tree_path_down">
<return-type type="void" />
@ -17014,7 +17014,7 @@
</boxed>
<boxed name="TreeRowReference" cname="GtkTreeRowReference" opaque="true">
<method name="Copy" cname="gtk_tree_row_reference_copy">
<return-type type="GtkTreeRowReference*" />
<return-type type="GtkTreeRowReference*" owned="true" />
</method>
<method name="Deleted" cname="gtk_tree_row_reference_deleted" shared="true">
<return-type type="void" />

View file

@ -7,6 +7,7 @@
<attr path="/api/namespace/object[@cname='GtkHTML']/method[@name='BeginContent']" name="name">Begin</attr>
<attr path="/api/namespace/object[@cname='GtkHTML']/method[@name='BeginFull']" name="name">Begin</attr>
<attr path="/api/namespace/struct[@cname='GtkHTMLStream']" name="opaque">1</attr>
<attr path="/api/namespace/struct[@cname='GtkHTMLStream']/method[@name='Destroy']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkHTMLStream']/method[@name='Write']/*/*[@name='buffer']" name="type">const-guchar*</attr>
<attr path="/api/namespace/struct[@cname='GtkHTMLStream']/method[@name='Write']/*/*[@name='buffer']" name="array">1</attr>
</metadata>

View file

@ -30,3 +30,14 @@ public void Write (string buffer)
gtk_html_stream_write (Handle, bytes, new UIntPtr ((ulong)bytes.Length));
}
// We hide this method and then reimplement it by hand to keep OpaqueGen from using
// it in Dispose(), since calling it after a Close() will result in a crash.
[DllImport("gtkhtml-3.0")]
static extern void gtk_html_stream_destroy (IntPtr stream);
public void Destroy ()
{
gtk_html_stream_destroy (Handle);
}

View file

@ -26,7 +26,10 @@ namespace Pango {
[DllImport("libpango-1.0-0.dll")]
static extern IntPtr pango_attr_font_desc_new (IntPtr font_desc);
public AttrFontDesc (Pango.FontDescription font_desc) : this (pango_attr_font_desc_new (font_desc.Handle)) {}
[DllImport("libpango-1.0-0.dll")]
static extern IntPtr pango_font_description_copy(IntPtr raw);
public AttrFontDesc (Pango.FontDescription font_desc) : this (pango_attr_font_desc_new (pango_font_description_copy (font_desc.Handle))) {}
internal AttrFontDesc (IntPtr raw) : base (raw) {}

View file

@ -29,6 +29,7 @@
desc = new FontDescription ();
IntPtr language_handle, list_handle;
pango_attr_iterator_get_font (Handle, desc.Handle, out language_handle, out list_handle);
desc.Family = desc.Family; // change static string to allocated one
language = language_handle == IntPtr.Zero ? null : new Language (language_handle);
if (list_handle == IntPtr.Zero) {
extra_attrs = new Pango.Attribute [0];

View file

@ -1,7 +1,17 @@
<?xml version="1.0"?>
<metadata>
<attr path="/api/namespace/boxed[@cname='PangoAttrList']/method[@name='Filter']/*/*[@name='func']" name="scope">call</attr>
<attr path="/api/namespace/boxed[@cname='PangoAttrList']/method[@name='GetIterator']/return-type" name="owned">true</attr>
<attr path="/api/namespace/boxed[@cname='PangoAttrList']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='PangoAttrList']/method[@name='Unref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='PangoFontDescription']/method[@name='CopyStatic']/return-type" name="owned">true</attr>
<attr path="/api/namespace/boxed[@cname='PangoFontDescription']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='PangoFontDescription']/method[@name='FromString']/return-type" name="owned">true</attr>
<attr path="/api/namespace/boxed[@cname='PangoFontMetrics']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='PangoFontMetrics']/method[@name='Unref']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='PangoLayoutIter']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='PangoTabArray']/constructor[@cname='pango_tab_array_new_with_positions']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='PangoTabArray']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/boxed[@cname='PangoTabArray']/method[@name='GetTabs']" name="hidden">1</attr>
<attr path="/api/namespace/callback[@cname='PangoFT2SubstituteFunc']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='PangoAttr_']" name="hidden">1</attr>
@ -14,18 +24,22 @@
<attr path="/api/namespace/class[@cname='PangoGlobal']/method[@name='ScanWord']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='PangoGlobal']/method[@name='SkipSpace']/*/*[@name='pos']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='PangoContext']/method[@name='ListFamilies']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='PangoFont']/method[@name='Describe']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='PangoFont']/method[@name='DescriptionsFree']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='PangoFontFace']/method[@name='Describe']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='PangoFontFamily']/method[@name='ListFaces']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='PangoFontMap']/method[@name='ListFamilies']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='PangoFontset']/method[@name='Foreach']/*/*[@name='func']" name="scope">call</attr>
<attr path="/api/namespace/object[@cname='PangoFT2FontMap']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetCursorPos']/*/*[@type='PangoRectangle*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetExtents']/*/*[@type='PangoRectangle*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetIter']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetLines']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetLogAttrs']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetPixelExtents']/*/*[@type='PangoRectangle*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetPixelSize']/*/*[@type='int*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetSize']/*/*[@type='int*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='GetTabs']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='IndexToPos']/*/*[@type='PangoRectangle*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='SetMarkup']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='PangoLayout']/method[@name='SetMarkupWithAccel']" name="hidden">1</attr>
@ -36,13 +50,16 @@
<attr path="/api/namespace/struct[@cname='PangoAttrFloat']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrFontDesc']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrInt']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrIterator']/method[@name='Destroy']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrIterator']/method[@name='GetAttrs']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrIterator']/method[@name='GetFont']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrLanguage']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrShape']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrSize']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoAttrString']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoCoverage']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='PangoCoverage']/method[@name='ToBytes']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoCoverage']/method[@name='Unref']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='PangoGlyphItem']/method[@name='ApplyAttrs']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']" name="opaque">1</attr>
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/field[@name='Layout']" name="access">public</attr>
@ -51,6 +68,8 @@
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/method[@name='GetExtents']/*/*[@type='PangoRectangle*']" name="pass_as">ref</attr>
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/method[@name='GetPixelExtents']/*/*[@type='PangoRectangle*']" name="pass_as">ref</attr>
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/method[@name='GetXRanges']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/method[@name='Unref']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='PangoScriptIter']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoWin32FontCache']" name="hidden">1</attr>
</metadata>

View file

@ -396,7 +396,7 @@
<return-type type="void" />
</method>
<method name="Copy" cname="pango_layout_copy">
<return-type type="PangoLayout*" />
<return-type type="PangoLayout*" owned="true" />
</method>
<method name="GetAlignment" cname="pango_layout_get_alignment">
<return-type type="PangoAlignment" />
@ -669,7 +669,7 @@
</struct>
<struct name="AttrIterator" cname="PangoAttrIterator" opaque="true">
<method name="Copy" cname="pango_attr_iterator_copy">
<return-type type="PangoAttrIterator*" />
<return-type type="PangoAttrIterator*" owned="true" />
</method>
<method name="Destroy" cname="pango_attr_iterator_destroy">
<return-type type="void" />
@ -719,7 +719,7 @@
</parameters>
</method>
<method name="Copy" cname="pango_attr_list_copy">
<return-type type="PangoAttrList*" />
<return-type type="PangoAttrList*" owned="true" />
</method>
<method name="Filter" cname="pango_attr_list_filter">
<return-type type="PangoAttrList*" />
@ -782,7 +782,7 @@
<field name="StartIndex" cname="start_index" type="guint" />
<field name="EndIndex" cname="end_index" type="guint" />
<method name="Copy" cname="pango_attribute_copy">
<return-type type="PangoAttribute*" />
<return-type type="PangoAttribute*" owned="true" />
</method>
<method name="Destroy" cname="pango_attribute_destroy">
<return-type type="void" />
@ -799,7 +799,7 @@
<field name="Green" cname="green" type="guint16" />
<field name="Blue" cname="blue" type="guint16" />
<method name="Copy" cname="pango_color_copy">
<return-type type="PangoColor*" />
<return-type type="PangoColor*" owned="true" />
</method>
<method name="Free" cname="pango_color_free">
<return-type type="void" />
@ -816,7 +816,7 @@
</boxed>
<struct name="Coverage" cname="PangoCoverage" opaque="true">
<method name="Copy" cname="pango_coverage_copy">
<return-type type="PangoCoverage*" />
<return-type type="PangoCoverage*" owned="true" />
</method>
<method name="FromBytes" cname="pango_coverage_from_bytes" shared="true">
<return-type type="PangoCoverage*" />
@ -870,7 +870,7 @@
</parameters>
</method>
<method name="Copy" cname="pango_font_description_copy">
<return-type type="PangoFontDescription*" />
<return-type type="PangoFontDescription*" owned="true" />
</method>
<method name="CopyStatic" cname="pango_font_description_copy_static">
<return-type type="PangoFontDescription*" />
@ -1045,7 +1045,7 @@
<field name="LogClusters" cname="log_clusters" type="gint*" />
<field name="Space" cname="space" type="gint" access="private" />
<method name="Copy" cname="pango_glyph_string_copy">
<return-type type="PangoGlyphString*" />
<return-type type="PangoGlyphString*" owned="true" />
</method>
<method name="Extents" cname="pango_glyph_string_extents">
<return-type type="void" />
@ -1120,7 +1120,7 @@
<field name="NumChars" cname="num_chars" type="gint" />
<field name="Analysis" cname="analysis" type="PangoAnalysis" />
<method name="Copy" cname="pango_item_copy">
<return-type type="PangoItem*" />
<return-type type="PangoItem*" owned="true" />
</method>
<method name="Free" cname="pango_item_free">
<return-type type="void" />
@ -1333,7 +1333,7 @@
</struct>
<boxed name="TabArray" cname="PangoTabArray" opaque="true">
<method name="Copy" cname="pango_tab_array_copy">
<return-type type="PangoTabArray*" />
<return-type type="PangoTabArray*" owned="true" />
</method>
<method name="Free" cname="pango_tab_array_free">
<return-type type="void" />

View file

@ -430,7 +430,7 @@
<return-type type="void" />
</method>
<method name="Copy" cname="pango_layout_copy">
<return-type type="PangoLayout*" />
<return-type type="PangoLayout*" owned="true" />
</method>
<method name="GetAlignment" cname="pango_layout_get_alignment">
<return-type type="PangoAlignment" />
@ -913,7 +913,7 @@
</struct>
<struct name="AttrIterator" cname="PangoAttrIterator" opaque="true">
<method name="Copy" cname="pango_attr_iterator_copy">
<return-type type="PangoAttrIterator*" />
<return-type type="PangoAttrIterator*" owned="true" />
</method>
<method name="Destroy" cname="pango_attr_iterator_destroy">
<return-type type="void" />
@ -963,7 +963,7 @@
</parameters>
</method>
<method name="Copy" cname="pango_attr_list_copy">
<return-type type="PangoAttrList*" />
<return-type type="PangoAttrList*" owned="true" />
</method>
<method name="Filter" cname="pango_attr_list_filter">
<return-type type="PangoAttrList*" />
@ -1053,7 +1053,7 @@
<field name="StartIndex" cname="start_index" type="guint" />
<field name="EndIndex" cname="end_index" type="guint" />
<method name="Copy" cname="pango_attribute_copy">
<return-type type="PangoAttribute*" />
<return-type type="PangoAttribute*" owned="true" />
</method>
<method name="Destroy" cname="pango_attribute_destroy">
<return-type type="void" />
@ -1070,7 +1070,7 @@
<field name="Green" cname="green" type="guint16" />
<field name="Blue" cname="blue" type="guint16" />
<method name="Copy" cname="pango_color_copy">
<return-type type="PangoColor*" />
<return-type type="PangoColor*" owned="true" />
</method>
<method name="Free" cname="pango_color_free">
<return-type type="void" />
@ -1087,7 +1087,7 @@
</boxed>
<struct name="Coverage" cname="PangoCoverage" opaque="true">
<method name="Copy" cname="pango_coverage_copy">
<return-type type="PangoCoverage*" />
<return-type type="PangoCoverage*" owned="true" />
</method>
<method name="FromBytes" cname="pango_coverage_from_bytes" shared="true">
<return-type type="PangoCoverage*" />
@ -1141,7 +1141,7 @@
</parameters>
</method>
<method name="Copy" cname="pango_font_description_copy">
<return-type type="PangoFontDescription*" />
<return-type type="PangoFontDescription*" owned="true" />
</method>
<method name="CopyStatic" cname="pango_font_description_copy_static">
<return-type type="PangoFontDescription*" />
@ -1348,7 +1348,7 @@
<field name="LogClusters" cname="log_clusters" type="gint*" />
<field name="Space" cname="space" type="gint" access="private" />
<method name="Copy" cname="pango_glyph_string_copy">
<return-type type="PangoGlyphString*" />
<return-type type="PangoGlyphString*" owned="true" />
</method>
<method name="Extents" cname="pango_glyph_string_extents">
<return-type type="void" />
@ -1423,7 +1423,7 @@
<field name="NumChars" cname="num_chars" type="gint" />
<field name="Analysis" cname="analysis" type="PangoAnalysis" />
<method name="Copy" cname="pango_item_copy">
<return-type type="PangoItem*" />
<return-type type="PangoItem*" owned="true" />
</method>
<method name="Free" cname="pango_item_free">
<return-type type="void" />
@ -1623,7 +1623,7 @@
</parameters>
</method>
<method name="Copy" cname="pango_matrix_copy">
<return-type type="PangoMatrix*" />
<return-type type="PangoMatrix*" owned="true" />
</method>
<method name="Free" cname="pango_matrix_free">
<return-type type="void" />
@ -1682,7 +1682,7 @@
</struct>
<boxed name="TabArray" cname="PangoTabArray" opaque="true">
<method name="Copy" cname="pango_tab_array_copy">
<return-type type="PangoTabArray*" />
<return-type type="PangoTabArray*" owned="true" />
</method>
<method name="Free" cname="pango_tab_array_free">
<return-type type="void" />

View file

@ -836,6 +836,9 @@ sub addReturnElem
my $ret_elem = $doc->createElement('return-type');
$parent->appendChild($ret_elem);
$ret_elem->setAttribute('type', $ret);
if ($parent->getAttribute('name') eq "Copy" && $ret =~ /\*$/) {
$ret_elem->setAttribute('owned', 'true');
}
return $ret_elem;
}

View file

@ -1,5 +1,9 @@
<?xml version="1.0"?>
<metadata>
<attr path="/api/namespace/class[@cname='RsvgCss_']/method[@name='ParseList']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='RsvgDefs']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='RsvgHandle']/method[@name='Free']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='RsvgHandle']/method[@name='Write']/*/*[@name='buf']" name="array">1</attr>
<attr path="/api/namespace/struct[@cname='RsvgPaintServer']/method[@name='Ref']" name="deprecated">1</attr>
<attr path="/api/namespace/struct[@cname='RsvgPaintServer']/method[@name='Unref']" name="deprecated">1</attr>
</metadata>