Mercurial > hg > openttd
changeset 17330:b217c2b6168c draft
(svn r22070) -Fix [FS#4503] (r21399): crashes when disconnecting after requesting the map
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 12 Feb 2011 21:30:57 +0000 |
parents | 9fab615a39a4 |
children | 9d66cbab310c |
files | src/network/network_server.cpp src/openttd.cpp src/saveload/saveload.h |
diffstat | 3 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -181,8 +181,12 @@ 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;
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -75,7 +75,6 @@ void DoPaletteAnimations(); void MusicLoop(); void ResetMusic(); -void ProcessAsyncSaveFinish(); void CallWindowTickEvent(); extern void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
--- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -54,6 +54,7 @@ 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);