diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/updatewindow.cpp | 18 | ||||
-rw-r--r-- | src/gui/updatewindow.h | 5 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 654ecaaf..c8be462f 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -48,9 +48,9 @@ UpdaterWindow::UpdaterWindow(): Window("Updating..."), mThread(NULL), mMutex(NULL), mDownloadStatus(UPDATE_NEWS), mUpdateHost(""), mCurrentFile("news.txt"), mBasePath(""), - mStoreInMemory(true), mDownloadComplete(true), mDownloadedBytes(0), - mMemoryBuffer(NULL), mCurlError(new char[CURL_ERROR_SIZE]), - mFileIndex(0) + mStoreInMemory(true), mDownloadComplete(true), mUserCancel(false), + mDownloadedBytes(0), mMemoryBuffer(NULL), + mCurlError(new char[CURL_ERROR_SIZE]), mFileIndex(0) { mCurlError[0] = 0; @@ -133,6 +133,8 @@ void UpdaterWindow::action(const std::string& eventId, gcn::Widget* widget) { if (eventId == "cancel") { + // Register the user cancel + mUserCancel=true; // Skip the updating process if (mDownloadStatus == UPDATE_COMPLETE) { @@ -329,7 +331,15 @@ void UpdaterWindow::logic() case UPDATE_ERROR: if (mThread) { - SDL_WaitThread(mThread, NULL); + if(mUserCancel){ + // Kill the thread, because user has canceled + SDL_KillThread(mThread); + // Set the flag to false again + mUserCancel = false; + } + else{ + SDL_WaitThread(mThread, NULL); + } mThread = NULL; } addRow(""); diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h index 8a168be8..5016036d 100644 --- a/src/gui/updatewindow.h +++ b/src/gui/updatewindow.h @@ -162,6 +162,11 @@ class UpdaterWindow : public Window, public gcn::ActionListener bool mDownloadComplete; /** + * Flag that show if the user has canceled the update + */ + bool mUserCancel; + + /** * Byte count currently downloaded in mMemoryBuffer. */ int mDownloadedBytes; |