From a602845d0a35331f1e012cd13ca921c6bc42b58d Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 1 Mar 2024 22:08:18 +0000 Subject: [PATCH] Fix #12202: Race condition when using sprite picker. (#12204) When using the sprite picker the screen is redrawn so that the sprites under the mouse cursor can be captured. This redraw also caused the sprite aligner window to be redrawn before the OnInvalidateData event that updates its scrollbars with the list count. --- src/newgrf_debug_gui.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 9dcd14c9d9..e200515e26 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -930,6 +930,9 @@ struct SpriteAlignerWindow : Window { } case WID_SA_LIST: { + /* Don't redraw sprite list while it is still being filled by picker. */ + if (_newgrf_debug_sprite_picker.mode == SPM_REDRAW) break; + const NWidgetBase *nwid = this->GetWidget(widget); int step_size = nwid->resize_y;