diff options
Diffstat (limited to 'gee/promise.vala')
-rw-r--r-- | gee/promise.vala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gee/promise.vala b/gee/promise.vala index 90eac07..401014d 100644 --- a/gee/promise.vala +++ b/gee/promise.vala @@ -34,6 +34,10 @@ using GLib; * @since 0.11.0 */ public class Gee.Promise<G> { + public Promise () { + _future = new Future<G> (); + } + ~Promise () { _future.abandon (); } @@ -66,6 +70,10 @@ public class Gee.Promise<G> { } private class Future<G> : Object, Gee.Future<G> { + public Future () { + _when_done = new Gee.Future.SourceFuncArrayElement<G>[0]; + } + public bool ready { get { _mutex.lock (); @@ -196,7 +204,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 +213,6 @@ public class Gee.Promise<G> { READY } } - private Future<G> _future = new Future<G>(); + private Future<G> _future; } |