X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkwin.c;h=4cce11e6e52b9431fab0df0423ced7c835a81605;hb=cc66c86e7311c97db09da989c340ba3108c9e14f;hp=19ada0b8d5a045151510734ca5b65c04a2e80721;hpb=f272ea88db4620c8b30b09d5ac905f1fc5ee8bb0;p=PuTTY.git diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 19ada0b8..4cce11e6 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -1476,7 +1476,21 @@ static gint timer_trigger(gpointer data) unsigned long next, then; long ticks; - if (run_timers(now, &next)) { + /* + * Destroy the timer we got here on. + */ + if (timer_id) { + gtk_timeout_remove(timer_id); + timer_id = 0; + } + + /* + * run_timers() may cause a call to timer_change_notify, in which + * case a new timer will already have been set up and left in + * timer_id. If it hasn't, and run_timers reports that some timing + * still needs to be done, we do it ourselves. + */ + if (run_timers(now, &next) && !timer_id) { then = now; now = GETTICKCOUNT(); if (now - then > next - then) @@ -1488,8 +1502,9 @@ static gint timer_trigger(gpointer data) } /* - * Never let a timer resume. If we need another one, we've - * asked for it explicitly above. + * Returning FALSE means 'don't call this timer again', which + * _should_ be redundant given that we removed it above, but just + * in case, return FALSE anyway. */ return FALSE; }