Fix generator to use MiniObject.OwnedHandle for parameters with owned="true"

This commit is contained in:
Maarten Bosmans 2009-06-12 16:37:08 +02:00 committed by Sebastian Dröge
parent b3b018c916
commit 896ddae3c5
3 changed files with 15 additions and 1 deletions

View file

@ -312,6 +312,11 @@ namespace GtkSharp.Generation {
sw.Close ();
}
public string CallByName (string name, bool owned)
{
return name + " == null ? IntPtr.Zero : " + name + (owned ? ".OwnedHandle" : ".Handle");
}
public override string FromNative (string var, bool owned)
{
return "Gst.MiniObject.GetObject(" + var + (owned ? ", true" : "") + ") as " + QualifiedName;

View file

@ -411,6 +411,11 @@ namespace GtkSharp.Generation {
sw.WriteLine ("}");
sw.Close ();
}
public string CallByName (string name, bool owned)
{
return name + " == null ? IntPtr.Zero : " + name + (owned ? ".OwnedHandle" : ".Handle");
}
}
}

View file

@ -262,8 +262,12 @@ namespace GtkSharp.Generation {
call_parm += CallName;
} else if (gen is IManualMarshaler)
call_parm = "native_" + CallName;
else if (gen is MiniObjectGen)
call_parm = ((MiniObjectGen) gen).CallByName(CallName, Owned);
else if (gen is ObjectGen)
call_parm = ((ObjectGen) gen).CallByName(CallName, Owned);
else
call_parm = SymbolTable.Table.CallByName(CType, CallName);
call_parm = gen.CallByName(CallName);
return call_parm;
}