--- a/src/saveload.cpp Tue Jun 17 10:32:49 2008 +0000
+++ b/src/saveload.cpp Tue Jun 17 13:22:13 2008 +0000
@@ -95,6 +95,7 @@
typedef void (*AsyncSaveFinishProc)();
static AsyncSaveFinishProc _async_save_finish = NULL;
+static ThreadObject *_save_thread;
/**
* Called by save thread to tell we finished saving.
@@ -117,6 +118,12 @@
_async_save_finish();
_async_save_finish = NULL;
+
+ if (_save_thread != NULL) {
+ _save_thread->Join();
+ delete _save_thread;
+ _save_thread = NULL;
+ }
}
/**
@@ -1545,8 +1552,6 @@
SaveFileDone();
}
-static ThreadObject *_save_thread;
-
/** We have written the whole game into memory, _Savegame_pool, now find
* and appropiate compressor and start writing to file.
*/
@@ -1617,6 +1622,7 @@
if (_save_thread == NULL) return;
_save_thread->Join();
+ delete _save_thread;
_save_thread = NULL;
}