From f6f4ff58c75503e8d55b939390f00620d7681db5 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 1 Mar 2024 21:26:51 +0000 Subject: [PATCH] Fix #12202: Race condition when use sprite picker. 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;