diff options
author | glx22 <glx@openttd.org> | 2021-05-15 23:12:25 +0200 |
---|---|---|
committer | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-05-29 21:08:25 +0200 |
commit | 994bf19aef3dde6c9482434bdc51688f76a937ea (patch) | |
tree | 9b45b82d460cb00733144ba0dd64ebc6fde478c2 /src/station_gui.cpp | |
parent | ef991b1772f5f8b4874f76ea715a9a95811ad979 (diff) | |
download | openttd-994bf19aef3dde6c9482434bdc51688f76a937ea.tar.xz |
Fix f6d5c01: Delay deletion when closing windows
Diffstat (limited to 'src/station_gui.cpp')
-rw-r--r-- | src/station_gui.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp index ab0eb5d1a..7fb1b66a4 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -1334,7 +1334,7 @@ struct StationViewWindow : public Window { this->owner = Station::Get(window_number)->owner; } - ~StationViewWindow() + void Close() override { DeleteWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false); DeleteWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->window_number).Pack(), false); @@ -1342,6 +1342,7 @@ struct StationViewWindow : public Window { DeleteWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->window_number).Pack(), false); SetViewportCatchmentStation(Station::Get(this->window_number), false); + this->Window::Close(); } /** @@ -2285,11 +2286,12 @@ struct SelectStationWindow : Window { _thd.freeze = true; } - ~SelectStationWindow() + void Close() override { if (_settings_client.gui.station_show_coverage) SetViewportCatchmentStation(nullptr, true); _thd.freeze = false; + this->Window::Close(); } void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override @@ -2424,7 +2426,7 @@ static bool StationJoinerNeeded(const CommandContainer &cmd, TileArea ta) Window *selection_window = FindWindowById(WC_SELECT_STATION, 0); if (selection_window != nullptr) { /* Abort current distant-join and start new one */ - delete selection_window; + selection_window->Close(); UpdateTileSelection(); } |