commit 3d143ef2843dd73d19fa548d36829b7eb5cbe103
Author: Ole André Vadla Ravnås <ole.andre.ravnas@tillitech.com>
Date:   Mon Nov 17 13:58:01 2014 +0100

    Fix memory-leaks by avoiding field initializers for generic fields
    
    Discussed this briefly with upstream on IRC, and it was concluded that
    this should probably have been forbidden by the Vala compiler in the
    first place.

diff --git a/gee/concurrentset.vala b/gee/concurrentset.vala
index dc4b249..ebe2d89 100644
--- a/gee/concurrentset.vala
+++ b/gee/concurrentset.vala
@@ -36,6 +36,10 @@ public class Gee.ConcurrentSet<G> : AbstractSortedSet<G> {
 		_cmp = (owned)compare_func;
 	}
 
+	construct {
+		_head = new Tower<G>.head ();
+	}
+
 	~ConcurrentSet () {
 		HazardPointer.Context ctx = new HazardPointer.Context ();
 		Utils.Misc.unused (ctx);
@@ -246,7 +250,7 @@ public class Gee.ConcurrentSet<G> : AbstractSortedSet<G> {
 #endif
 
 	private int _size = 0;
-	private Tower<G> _head = new Tower<G>.head ();
+	private Tower<G> _head;
 	private CompareDataFunc<G>? _cmp;
 	private const int _MAX_HEIGHT = 31;
 	private static Private rand = new Private((ptr) => {
diff --git a/gee/lazy.vala b/gee/lazy.vala
index 00c34ba..61808bc 100644
--- a/gee/lazy.vala
+++ b/gee/lazy.vala
@@ -77,6 +77,10 @@ public class Gee.Lazy<G> {
 			_lazy = lazy;
 		}
 
+		construct {
+			_when_done = new Gee.Future.SourceFuncArrayElement<G>[0];
+		}
+
 		public bool ready {
 			get {
 				_mutex.lock ();
@@ -160,7 +164,7 @@ public class Gee.Lazy<G> {
 		private Cond _eval = Cond ();
 		private Lazy<G> _lazy;
 		private State _state = State.UNLOCK;
-		private Gee.Future.SourceFuncArrayElement<G>[]? _when_done = new Gee.Future.SourceFuncArrayElement<G>[0];
+		private Gee.Future.SourceFuncArrayElement<G>[]? _when_done;
 		private enum State {
 			UNLOCK,
 			EVAL
diff --git a/gee/priorityqueue.vala b/gee/priorityqueue.vala
index 31be4ab..2e944a0 100644
--- a/gee/priorityqueue.vala
+++ b/gee/priorityqueue.vala
@@ -60,11 +60,7 @@ public class Gee.PriorityQueue<G> : Gee.AbstractQueue<G> {
 	private Type2Node<G>? _lm_head = null;
 	private Type2Node<G>? _lm_tail = null;
 	private Type1Node<G>? _p = null;
-#if VALA_0_16
-	private Type1Node<G>?[] _a = new Type1Node<G>?[0];
-#else
-	private Type1Node<G>?[] _a = new Type1Node<G>[0];
-#endif
+	private Type1Node<G>?[] _a;
 	private NodePair<G>? _lp_head = null;
 	private unowned NodePair<G>? _lp_tail = null;
 	private bool[] _b = new bool[0];
@@ -89,6 +85,14 @@ public class Gee.PriorityQueue<G> : Gee.AbstractQueue<G> {
 		_compare_func = (owned)compare_func;
 	}
 
+	construct {
+#if VALA_0_16
+		_a = new Type1Node<G>?[0];
+#else
+		_a = new Type1Node<G>[0];
+#endif
+	}
+
 	/**
 	 * {@inheritDoc}
 	 */
diff --git a/gee/promise.vala b/gee/promise.vala
index 90eac07..b4c17df 100644
--- a/gee/promise.vala
+++ b/gee/promise.vala
@@ -34,6 +34,12 @@ using GLib;
  * @since 0.11.0
  */
 public class Gee.Promise<G> {
+	private Future<G> _future;
+
+	public Promise () {
+		_future = new Future<G> ();
+	}
+
 	~Promise () {
 		_future.abandon ();
 	}
@@ -66,6 +72,10 @@ public class Gee.Promise<G> {
 	}
 
 	private class Future<G> : Object, Gee.Future<G> {
+		construct {
+			_when_done = new Gee.Future.SourceFuncArrayElement<G>[0];
+		}
+
 		public bool ready {
 			get {
 				_mutex.lock ();
@@ -196,7 +206,7 @@ public class Gee.Promise<G> {
 		private State _state;
 		private G? _value;
 		private GLib.Error? _exception;
-		private Gee.Future.SourceFuncArrayElement<G>[]? _when_done = new Gee.Future.SourceFuncArrayElement<G>[0];
+		private Gee.Future.SourceFuncArrayElement<G>[]? _when_done;
 
 		private enum State {
 			INIT,
@@ -205,6 +215,5 @@ public class Gee.Promise<G> {
 			READY
 		}
 	}
-	private Future<G> _future = new Future<G>();
 }
 
