]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
fix memory management of property getters with ownership transfer, fixes
authorJuerg Billeter <j@bitron.ch>
Thu, 10 Jan 2008 09:29:59 +0000 (09:29 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Thu, 10 Jan 2008 09:29:59 +0000 (09:29 +0000)
2008-01-10  Juerg Billeter  <j@bitron.ch>

* vala/valamemorymanager.vala: fix memory management of property
  getters with ownership transfer, fixes bug 505713

svn path=/trunk/; revision=825

ChangeLog
vala/valamemorymanager.vala

index ebbe87525975fb3d7f34a8e3f2a882ed0cfe7053..1db662a56717610c3ff4dc67ad69d8a498613eef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-10  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valamemorymanager.vala: fix memory management of property
+         getters with ownership transfer, fixes bug 505713
+
 2008-01-10  Jürg Billeter  <j@bitron.ch>
 
        * vapi/glib-2.0.vapi: fix binding of textdomain, fixes bug 508453
index 0af9c05b609f1c5ba11cc897ee58e1bc302cbf33..9c7e79736006308b79f745556a0d53303df1a7bd 100644 (file)
@@ -1,6 +1,6 @@
 /* valamemorymanager.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2008  Jürg Billeter, Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -171,9 +171,16 @@ public class Vala.MemoryManager : CodeVisitor {
                                                visit_possibly_leaked_expression (stmt.return_expression);
                                        }
                                }
-                       } else {
+                       } else if (current_symbol is Property) {
                                /* property get accessor */
-                               visit_possibly_leaked_expression (stmt.return_expression);
+                               var prop = (Property) current_symbol;
+                               if (prop.type_reference.transfers_ownership) {
+                                       visit_possibly_missing_copy_expression (stmt.return_expression);
+                               } else {
+                                       visit_possibly_leaked_expression (stmt.return_expression);
+                               }
+                       } else {
+                               assert_not_reached ();
                        }
                }
        }