summaryrefslogtreecommitdiff
path: root/codegen/valagirwriter.vala
diff options
context:
space:
mode:
authorMichal Hruby <michal.mhr@gmail.com>2012-06-12 13:57:07 +0200
committerMichal Hruby <michal.mhr@gmail.com>2012-06-12 13:57:07 +0200
commitd44ecb80a702aad220f1091751ca19eadb21bc77 (patch)
tree1c19b896432d9696ca3b7d24d73411d87d172353 /codegen/valagirwriter.vala
parent52d2776163bee64ce85de92b03e2f9ee9545a5c4 (diff)
downloadvala-d44ecb80a702aad220f1091751ca19eadb21bc77.tar.gz
girwriter: Use transfer-ownership=none for InitiallyUnowned based constructors
Diffstat (limited to 'codegen/valagirwriter.vala')
-rw-r--r--codegen/valagirwriter.vala4
1 files changed, 3 insertions, 1 deletions
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index eff974868..7a5cacf61 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -109,6 +109,7 @@ public class Vala.GIRWriter : CodeVisitor {
int indent;
private TypeSymbol gobject_type;
+ private TypeSymbol ginitiallyunowned_type;
private struct GIRNamespace {
public GIRNamespace (string ns, string version) {
@@ -149,6 +150,7 @@ public class Vala.GIRWriter : CodeVisitor {
var root_symbol = context.root;
var glib_ns = root_symbol.scope.lookup ("GLib");
gobject_type = (TypeSymbol) glib_ns.scope.lookup ("Object");
+ ginitiallyunowned_type = (TypeSymbol) glib_ns.scope.lookup ("InitiallyUnowned");
write_package (package);
@@ -1156,7 +1158,7 @@ public class Vala.GIRWriter : CodeVisitor {
DelegateType delegate_type = type as DelegateType;
- if ((type.value_owned && delegate_type == null) || constructor) {
+ if ((type.value_owned && delegate_type == null) || (constructor && !type.data_type.is_subtype_of (ginitiallyunowned_type))) {
buffer.append_printf (" transfer-ownership=\"full\"");
} else {
buffer.append_printf (" transfer-ownership=\"none\"");