summaryrefslogtreecommitdiff
path: root/src/gui/updatewindow.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-09-21 12:08:32 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-09-21 12:08:32 +0000
commit592ce6b7d0a79f30f6741d30e2f473f74c882a48 (patch)
treeb0565035b42a120960e6fc667cf9f3521893f886 /src/gui/updatewindow.cpp
parentedc8acb22df82a5cec4cd5ffac0f81be053c6ec5 (diff)
downloadmana-client-592ce6b7d0a79f30f6741d30e2f473f74c882a48.tar.gz
mana-client-592ce6b7d0a79f30f6741d30e2f473f74c882a48.tar.bz2
mana-client-592ce6b7d0a79f30f6741d30e2f473f74c882a48.tar.xz
mana-client-592ce6b7d0a79f30f6741d30e2f473f74c882a48.zip
Made canceling the update process non-blocking (Patch by VictorSan)
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r--src/gui/updatewindow.cpp18
1 files changed, 14 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("");