From 2061741bd5112e1fbb05c203d45737cbd7d00d80 Mon Sep 17 00:00:00 2001 From: Robert Göffringmann Date: Sun, 6 Jul 2003 21:33:22 +0000 Subject: fix bug #766744 (BASS: Crash when quitting while quitting) svn-id: r8817 --- sky/control.cpp | 6 +++--- sky/sky.cpp | 5 +++-- sky/sky.h | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sky/control.cpp b/sky/control.cpp index 42b5815c25..a753d77153 100644 --- a/sky/control.cpp +++ b/sky/control.cpp @@ -1450,9 +1450,8 @@ void SkyControl::delay(unsigned int amount) { break; case OSystem::EVENT_QUIT: - showGameQuitMsg(false); - delay(1500); - _system->quit(); + if (!SkyState::_systemVars.quitting) + showGameQuitMsg(false); break; default: @@ -1472,6 +1471,7 @@ void SkyControl::delay(unsigned int amount) { void SkyControl::showGameQuitMsg(bool useScreen) { + SkyState::_systemVars.quitting = true; uint8 *textBuf1 = (uint8*)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader)); uint8 *textBuf2 = (uint8*)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader)); uint8 textNum; diff --git a/sky/sky.cpp b/sky/sky.cpp index 77a5408b6a..35ec77a9c0 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -71,7 +71,7 @@ Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst) { void **SkyState::_itemList[300]; -SystemVars SkyState::_systemVars = {0, 0, 0, 0, 4316, 0, false}; +SystemVars SkyState::_systemVars = {0, 0, 0, 0, 4316, 0, false, false }; SkyState::SkyState(GameDetector *detector, OSystem *syst) : Engine(detector, syst) { @@ -332,7 +332,8 @@ void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp break; case OSystem::EVENT_QUIT: - _skyControl->showGameQuitMsg(); // will call _system->quit() + if (!SkyState::_systemVars.quitting) + _skyControl->showGameQuitMsg(); // will call _system->quit() break; default: diff --git a/sky/sky.h b/sky/sky.h index 75a6256eba..e308cf0528 100644 --- a/sky/sky.h +++ b/sky/sky.h @@ -48,6 +48,7 @@ struct SystemVars { uint32 currentPalette; uint16 gameSpeed; bool pastIntro; + bool quitting; }; class SkyLogic; -- cgit v1.2.3