Change window close/deallocation to match upstream

This commit is contained in:
Jonathan G Rennison
2023-09-15 23:56:33 +01:00
parent 79cfc3e8bd
commit f5d1b1d8f8
50 changed files with 352 additions and 341 deletions

View File

@@ -109,9 +109,10 @@ BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(W
this->InitNested(WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
}
BaseNetworkContentDownloadStatusWindow::~BaseNetworkContentDownloadStatusWindow()
void BaseNetworkContentDownloadStatusWindow::Close()
{
_network_content_client.RemoveCallback(this);
this->Window::Close();
}
void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
@@ -200,8 +201,7 @@ public:
this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
}
/** Free whatever we've allocated */
~NetworkContentDownloadStatusWindow()
void Close() override
{
TarScanner::Mode mode = TarScanner::NONE;
for (auto ctype : this->receivedTypes) {
@@ -282,6 +282,8 @@ public:
/* Always invalidate the download window; tell it we are going to be gone */
InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST, 2);
this->BaseNetworkContentDownloadStatusWindow::Close();
}
void OnClick(Point pt, int widget, int click_count) override
@@ -289,7 +291,7 @@ public:
if (widget == WID_NCDS_CANCELOK) {
if (this->downloaded_bytes != this->total_bytes) {
_network_content_client.CloseConnection();
delete this;
this->Close();
} else {
/* If downloading succeeded, close the online content window. This will close
* the current window as well. */
@@ -572,10 +574,10 @@ public:
this->InvalidateData();
}
/** Free everything we allocated */
~NetworkContentListWindow()
void Close() override
{
_network_content_client.RemoveCallback(this);
this->Window::Close();
}
void OnInit() override
@@ -852,7 +854,7 @@ public:
break;
case WID_NCL_CANCEL:
delete this;
this->Close();
break;
case WID_NCL_OPEN_URL:
@@ -955,7 +957,7 @@ public:
{
if (!success) {
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, WL_ERROR);
delete this;
this->Close();
return;
}