summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-02-12 21:30:57 +0000
committerrubidium <rubidium@openttd.org>2011-02-12 21:30:57 +0000
commitbefa79ba4af31b7ec59a45a19b7f5634b420a266 (patch)
tree5f22fb77e789a27f378eb738dc799698e1365073 /src
parenta19bc28aba6ec682f74ad7f8f0fd8104bdece3af (diff)
downloadopenttd-befa79ba4af31b7ec59a45a19b7f5634b420a266.tar.xz
(svn r22070) -Fix [FS#4503] (r21399): crashes when disconnecting after requesting the map
Diffstat (limited to 'src')
-rw-r--r--src/network/network_server.cpp8
-rw-r--r--src/openttd.cpp1
-rw-r--r--src/saveload/saveload.h1
3 files changed, 7 insertions, 3 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 7e870d1c3..463db6855 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -181,8 +181,12 @@ ServerNetworkGameSocketHandler::~ServerNetworkGameSocketHandler()
if (this->savegame != NULL) this->savegame->cs = NULL;
if (this->savegame_mutex != NULL) this->savegame_mutex->EndCritical();
- /* Make sure the saving is completely cancelled. */
- if (this->savegame != NULL) WaitTillSaved();
+ /* Make sure the saving is completely cancelled.
+ * Yes, we need to handle the save finish as well
+ * as the next connection in this "loop" might
+ * just be requesting the map and such. */
+ WaitTillSaved();
+ ProcessAsyncSaveFinish();
while (this->savegame_packets != NULL) {
Packet *p = this->savegame_packets->next;
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 21eb89f57..c0780241c 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -75,7 +75,6 @@ void IncreaseDate();
void DoPaletteAnimations();
void MusicLoop();
void ResetMusic();
-void ProcessAsyncSaveFinish();
void CallWindowTickEvent();
extern void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index ff18615c2..7c8596532 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -54,6 +54,7 @@ void SetSaveLoadError(uint16 str);
const char *GetSaveLoadErrorString();
SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, bool threaded = true);
void WaitTillSaved();
+void ProcessAsyncSaveFinish();
void DoExitSave();
SaveOrLoadResult SaveWithFilter(struct SaveFilter *writer, bool threaded);