summaryrefslogtreecommitdiff
path: root/src/bootstrap_gui.cpp
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-05-15 23:12:25 +0200
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-05-29 21:08:25 +0200
commit994bf19aef3dde6c9482434bdc51688f76a937ea (patch)
tree9b45b82d460cb00733144ba0dd64ebc6fde478c2 /src/bootstrap_gui.cpp
parentef991b1772f5f8b4874f76ea715a9a95811ad979 (diff)
downloadopenttd-994bf19aef3dde6c9482434bdc51688f76a937ea.tar.xz
Fix f6d5c01: Delay deletion when closing windows
Diffstat (limited to 'src/bootstrap_gui.cpp')
-rw-r--r--src/bootstrap_gui.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp
index 7495e08ba..d8e4aedec 100644
--- a/src/bootstrap_gui.cpp
+++ b/src/bootstrap_gui.cpp
@@ -91,9 +91,10 @@ public:
this->InitNested(1);
}
- ~BootstrapErrorWindow()
+ void Close() override
{
_exit_game = true;
+ this->Window::Close();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
@@ -144,12 +145,13 @@ public:
{
}
- ~BootstrapContentDownloadStatusWindow()
+ void Close() override
{
/* If we are not set to exit the game, it means the bootstrap failed. */
if (!_exit_game) {
new BootstrapErrorWindow();
}
+ this->BaseNetworkContentDownloadStatusWindow::Close();
}
void OnDownloadComplete(ContentID cid) override
@@ -162,7 +164,7 @@ public:
/* _exit_game is used to break out of the outer video driver's MainLoop. */
_exit_game = true;
- delete this;
+ this->Close();
}
};
@@ -201,9 +203,10 @@ public:
}
/** Stop listening to the content client events. */
- ~BootstrapAskForDownloadWindow()
+ void Close() override
{
_network_content_client.RemoveCallback(this);
+ this->Window::Close();
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
@@ -264,7 +267,7 @@ public:
/* And once the meta data is received, start downloading it. */
_network_content_client.Select(ci->id);
new BootstrapContentDownloadStatusWindow();
- delete this;
+ this->Close();
}
};