From d51d85d49eb0429ba170c13de4ee8b4c277b7937 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 13 Oct 2009 14:34:45 -0600 Subject: Handle canceled downloads more gracefully --- src/gui/serverdialog.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gui/serverdialog.cpp') diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index f47f33ea..e97eb099 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -192,6 +192,7 @@ void ServerDialog::action(const gcn::ActionEvent &event) } else { + mDownload->cancel(); mQuitButton->setEnabled(false); mConnectButton->setEnabled(false); @@ -234,6 +235,7 @@ void ServerDialog::action(const gcn::ActionEvent &event) } else if (event.getId() == "quit") { + mDownload->cancel(); state = STATE_FORCE_QUIT; } else if (event.getId() == "addEntry") @@ -401,6 +403,9 @@ void ServerDialog::loadServers() int ServerDialog::downloadUpdate(void *ptr, DownloadStatus status, size_t total, size_t remaining) { + if (status == DOWNLOAD_STATUS_CANCELLED) + return -1; + ServerDialog *sd = reinterpret_cast(ptr); bool finished = false; -- cgit v1.2.3-70-g09d2