From f14d4c749720f77605d5f0cd81b3ced72cf42fce Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 3 Oct 2022 19:38:43 +0300 Subject: [PATCH 27/27] 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 46dc4b2d9c..39395164b3 100644 --- a/client/control.c +++ b/client/control.c @@ -868,7 +868,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) @@ -887,10 +887,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