[geary/wip/728002-webkit2: 2/13] Minor TimeoutManager optimisation.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/728002-webkit2: 2/13] Minor TimeoutManager optimisation.
- Date: Mon, 16 Jan 2017 04:56:14 +0000 (UTC)
commit 9d65f5284f01b479a5b96eb2d53abdd6eb9a93ef
Author: Michael James Gratton <mike vee net>
Date: Fri Jan 6 10:54:34 2017 +1100
Minor TimeoutManager optimisation.
src/engine/util/util-timeout-manager.vala | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/engine/util/util-timeout-manager.vala b/src/engine/util/util-timeout-manager.vala
index 92adfdc..d8c9322 100644
--- a/src/engine/util/util-timeout-manager.vala
+++ b/src/engine/util/util-timeout-manager.vala
@@ -102,12 +102,16 @@ public class Geary.TimeoutManager : BaseObject {
}
private bool on_trigger() {
- callback(this);
bool ret = Source.CONTINUE;
+ // If running only once, reset the source id now in case the
+ // callback resets the timer while it is executing, so we
+ // avoid removing the source just before it would be removed
+ // after this call anyway
if (this.repetition == Repeat.ONCE) {
this.source_id = -1;
ret = Source.REMOVE;
}
+ callback(this);
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]