[libgee/0.8] Fix memory leak in TreeSet and TreeMap



commit feb30ab5154427a6f3643cb942c727782a7187c6
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Mon Mar 4 17:05:11 2013 +0000

    Fix memory leak in TreeSet and TreeMap

 gee/treemap.vala |    4 ++++
 gee/treeset.vala |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gee/treemap.vala b/gee/treemap.vala
index 9ee094e..2d2708a 100644
--- a/gee/treemap.vala
+++ b/gee/treemap.vala
@@ -127,6 +127,10 @@ public class Gee.TreeMap<K,V> : Gee.AbstractBidirSortedMap<K,V> {
                this.value_equal_func = value_equal_func;
        }
 
+       ~TreeMap () {
+               clear ();
+       }
+
        private void rotate_right (ref Node<K, V> root) {
                Node<K,V> pivot = (owned) root.left;
                pivot.color = root.color;
diff --git a/gee/treeset.vala b/gee/treeset.vala
index 367c55e..1a19acc 100644
--- a/gee/treeset.vala
+++ b/gee/treeset.vala
@@ -71,6 +71,10 @@ public class Gee.TreeSet<G> : AbstractBidirSortedSet<G> {
                this.compare_func = compare_func;
        }
 
+       ~TreeSet () {
+               clear ();
+       }
+
        /**
         * { inheritDoc}
         */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]