summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Hruby <michal.mhr@gmail.com>2012-06-12 13:57:07 +0200
committerJürg Billeter <j@bitron.ch>2012-06-23 17:33:31 +0200
commit677b7be06db5dda437f4808760341b583c2390fc (patch)
tree234b7d69ddc7e5b46e9296c7579335efae7bf337
parentc60149f2697fef33bbdcd6e5ca319be854bca610 (diff)
downloadvala-677b7be06db5dda437f4808760341b583c2390fc.tar.gz
girwriter: Use transfer-ownership=none for InitiallyUnowned based constructors
-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\"");