From 3105f6391c64e36f640de2f07f66876c821147b4 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 20 Oct 2024 09:37:17 +0100 Subject: [PATCH] Fix #13002: Crash due to use of dangling types in picker GUI used/saved lists (#13008) --- src/picker_gui.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/picker_gui.cpp b/src/picker_gui.cpp index f947709cea..4f56485952 100644 --- a/src/picker_gui.cpp +++ b/src/picker_gui.cpp @@ -197,10 +197,14 @@ void PickerWindow::ConstructWindow() this->classes.SetSortFuncs(_class_sorter_funcs); this->classes.SetFilterFuncs(_class_filter_funcs); + /* Update saved type information. */ + this->callbacks.saved = this->callbacks.UpdateSavedItems(this->callbacks.saved); + + /* Clear used type information. */ + this->callbacks.used.clear(); + if (this->has_type_picker) { - /* Update used and saved type information. */ - this->callbacks.saved = this->callbacks.UpdateSavedItems(this->callbacks.saved); - this->callbacks.used.clear(); + /* Populate used type information. */ this->callbacks.FillUsedItems(this->callbacks.used); SetWidgetDisabledState(WID_PW_MODE_ALL, !this->callbacks.HasClassChoice());