summaryrefslogtreecommitdiff
path: root/vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2012-06-26 08:34:22 +0200
committerJürg Billeter <j@bitron.ch>2012-06-26 08:34:22 +0200
commit1f5a97f048b572187608b5411f060f4bd7931cba (patch)
tree7472a7d4e12d5c822ace94bcf420c52fe4e1f5f6 /vala
parent935d54f4cd6fe446aec73ea0804316f2c01cd8ab (diff)
downloadvala-1f5a97f048b572187608b5411f060f4bd7931cba.tar.gz
Fix crash due to incorrect copy of attribute list
Fixes bug 678824.
Diffstat (limited to 'vala')
-rw-r--r--vala/valagirparser.vala10
-rw-r--r--vala/valaparameter.vala10
2 files changed, 16 insertions, 4 deletions
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index a09e74229..f7c5dd304 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1,6 +1,6 @@
/* valagirparser.vala
*
- * Copyright (C) 2008-2010 Jürg Billeter
+ * Copyright (C) 2008-2012 Jürg Billeter
* Copyright (C) 2011 Luca Bruno
*
* This library is free software; you can redistribute it and/or
@@ -3459,7 +3459,13 @@ public class Vala.GirParser : CodeVisitor {
method.external = true;
method.coroutine = true;
method.has_construct_function = finish_method.has_construct_function;
- method.attributes = m.attributes.copy ();
+
+ // cannot use List.copy()
+ // as it returns a list of unowned elements
+ foreach (Attribute a in m.attributes) {
+ method.attributes.append (a);
+ }
+
method.set_attribute_string ("CCode", "cname", node.get_cname ());
if (finish_method_base == "new") {
method.name = null;
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index 22fe0c8ae..b089dde22 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -1,6 +1,6 @@
/* valaparameter.vala
*
- * Copyright (C) 2006-2011 Jürg Billeter
+ * Copyright (C) 2006-2012 Jürg Billeter
* Copyright (C) 2006-2008 Raffaele Sandrini
*
* This library is free software; you can redistribute it and/or
@@ -101,7 +101,13 @@ public class Vala.Parameter : Variable {
result.params_array = params_array;
result.direction = this.direction;
result.initializer = this.initializer;
- result.attributes = this.attributes.copy ();
+
+ // cannot use List.copy()
+ // as it returns a list of unowned elements
+ foreach (Attribute a in this.attributes) {
+ result.attributes.append (a);
+ }
+
return result;
} else {
return new Parameter.with_ellipsis ();