From faaea69b324a9a1191b2d6835e21db10fcc29698 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 3 Oct 2022 19:41:22 +0300 Subject: [PATCH 10/10] Queue draws from blink_active_unit() It's called from a timer, so the UI can be in such a state that one should not draw to it. On gtk-client this sometimes showed up as: "Gtk-WARNING gadget with negative dimensions" Reported by jdlh and Jacob Nevins See osdn #42263 Signed-off-by: Marko Lindqvist --- client/control.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/control.c b/client/control.c index 82ce005c69..1c10f8bfe6 100644 --- a/client/control.c +++ b/client/control.c @@ -856,7 +856,7 @@ struct unit *find_visible_unit(struct tile *ptile) } /************************************************************************** - Blink the active unit (if necessary). Return the time until the next + Blink the active unit (if necessary). Return the time until the next blink (in seconds). **************************************************************************/ double blink_active_unit(void) @@ -874,10 +874,10 @@ double blink_active_unit(void) timer_start(blink_timer); unit_list_iterate(get_units_in_focus(), punit) { - /* We flush to screen directly here. This is most likely faster - * since these drawing operations are all small but may be spread - * out widely. */ - refresh_unit_mapcanvas(punit, unit_tile(punit), FALSE, TRUE); + /* We used to unqueue here, but that's inherently risky + * for a function run from a timer - the UI can be in any + * inconsistent state. */ + refresh_unit_mapcanvas(punit, unit_tile(punit), FALSE, FALSE); } unit_list_iterate_end; } -- 2.35.1