[libgee/0.6] Fix memory leak in LinkedList.clear



commit 6dfd9bcdf5fc142d2bbc751bd1e8bc4f52f73f4a
Author: Jürg Billeter <j bitron ch>
Date:   Fri Jan 28 18:28:49 2011 +0100

    Fix memory leak in LinkedList.clear
    
    Based on patch by Travis Reitter, fixes bug 639254.

 gee/linkedlist.vala |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala
index fafecc7..5c9cfd3 100644
--- a/gee/linkedlist.vala
+++ b/gee/linkedlist.vala
@@ -59,8 +59,7 @@ public class Gee.LinkedList<G> : AbstractList<G>, Queue<G>, Deque<G> {
 	}
 	
 	~LinkedList () {
-		while (_head != null)
-			_remove_node (_head);
+		this.clear ();
 	}
 
 	/**
@@ -129,6 +128,10 @@ public class Gee.LinkedList<G> : AbstractList<G>, Queue<G>, Deque<G> {
 	 * { inheritDoc}
 	 */
 	public override void clear () {
+		while (_head != null) {
+			_remove_node (_head);
+		}
+
 		++this._stamp;
 		this._head = null;
 		this._tail = null;



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