diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/time.vala | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/time.vala b/src/time.vala index 05ffff9..4034c04 100644 --- a/src/time.vala +++ b/src/time.vala @@ -4,13 +4,16 @@ public class Time : Object { public signal void cancelled (); private Cancellable cancellable; private uint timeout_id; + private bool fulfilled = false; construct { cancellable = new Cancellable(); cancellable.cancelled.connect(() => { - Source.remove(timeout_id); - cancelled(); - dispose(); + if (!fulfilled) { + Source.remove(timeout_id); + cancelled(); + dispose(); + } }); } @@ -37,6 +40,7 @@ public class Time : Object { connect_closure(fn); timeout_id = Timeout.add(timeout, () => { now(); + fulfilled = true; return Source.REMOVE; }, prio); } @@ -45,6 +49,7 @@ public class Time : Object { connect_closure(fn); timeout_id = Idle.add(() => { now(); + fulfilled = true; return Source.REMOVE; }, prio); } |