From 58c0aac15f61eb0d934fdfdc00e0bf1b260798f6 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 1 Jun 2023 21:08:12 +0100 Subject: [PATCH] Fix re-opening GRF/script settings windows not closing drop down windows Causing assertion failure on drop down item selection See: #527 --- src/game/game_gui.cpp | 1 + src/newgrf_gui.cpp | 5 +++++ src/script/script_gui.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/game/game_gui.cpp b/src/game/game_gui.cpp index ca16eeda5b..59d721ff5b 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -113,6 +113,7 @@ struct GSConfigWindow : public Window { ~GSConfigWindow() { + HideDropDownMenu(this); DeleteWindowByClass(WC_SCRIPT_LIST); } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 556db0eaeb..b0953a0bd4 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -183,6 +183,11 @@ struct NewGRFParametersWindow : public Window { this->InvalidateData(); } + ~NewGRFParametersWindow() + { + HideDropDownMenu(this); + } + /** * Get a dummy parameter-info object with default information. * @param nr The param number that should be changed. diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 7ccbce795f..3151385760 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -325,6 +325,11 @@ struct ScriptSettingsWindow : public Window { this->RebuildVisibleSettings(); } + ~ScriptSettingsWindow() + { + HideDropDownMenu(this); + } + /** * Rebuilds the list of visible settings. AI settings with the flag * AICONFIG_AI_DEVELOPER set will only be visible if the game setting