]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
free lists of interfaces correctly, patch by Mathias Hasselmann
authorJürg Billeter <j@bitron.ch>
Tue, 20 Mar 2007 13:53:35 +0000 (13:53 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 20 Mar 2007 13:53:35 +0000 (13:53 +0000)
2007-03-20  Jürg Billeter  <j@bitron.ch>

* vala/valacodegenerator.vala: free lists of interfaces correctly, patch
  by Mathias Hasselmann

svn path=/trunk/; revision=244

vala/ChangeLog
vala/vala/valacodegenerator.vala

index f95dd5ad294a4615c1824957173cc75f1ad459c3..b2e3e870d499fbd3ff54333fb8e38958c594ca15 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-20  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valacodegenerator.vala: free lists of interfaces correctly, patch
+         by Mathias Hasselmann
+
 2007-03-17  Jürg Billeter  <j@bitron.ch>
 
        * compiler/valacompiler.vala, compiler/Makefile.am, vapi/config.vala:
index 3908e06cdefa828059e0ab26fd8eb73921b0d0cc..5f22c6783a2f895cc45470d82fcfbda60425970f 100644 (file)
@@ -2152,16 +2152,18 @@ public class Vala.CodeGenerator : CodeVisitor {
                if (unref_function == "g_list_free") {
                        bool is_ref = false;
                        bool is_class = false;
-                       var type_args = type.get_type_arguments ();
-                       foreach (TypeReference type_arg in type_args) {
-                               is_ref = type_arg.takes_ownership;
-                               is_class = type_arg.data_type is Class;
+                       bool is_interface = false;
+
+                       foreach (TypeReference type_arg in type.get_type_arguments ()) {
+                               is_ref |= type_arg.takes_ownership;
+                               is_class |= type_arg.data_type is Class;
+                               is_interface |= type_arg.data_type is Interface;
                        }
                        
                        if (is_ref) {
                                var cunrefcall = new CCodeFunctionCall (new CCodeIdentifier ("g_list_foreach"));
                                cunrefcall.add_argument (cvar);
-                               if (is_class) {
+                               if (is_class || is_interface) {
                                        cunrefcall.add_argument (new CCodeIdentifier ("(GFunc) g_object_unref"));
                                } else {
                                        cunrefcall.add_argument (new CCodeIdentifier ("(GFunc) g_free"));