fix exit race condition prevents game state saving

This commit is contained in:
Scott Ludwig 2016-01-01 12:01:27 -08:00
parent 24359365c2
commit c3e42fe2d6
3 changed files with 6 additions and 6 deletions

View File

@ -135,9 +135,9 @@ bool MessageQueue::Get(Message *pmsg, long64 ctWait)
return false;
}
void MessageQueue::Post(Message *pmsg, int idCoalesce)
void MessageQueue::Post(Message *pmsg, int idCoalesce, bool fEvenIfStopping)
{
if (stop_)
if (stop_ && !fEvenIfStopping)
return;
// Copy message before putting in queue

View File

@ -60,7 +60,7 @@ public:
virtual void Stop();
virtual bool IsStopping();
virtual bool Get(Message *pmsg, long64 ctWait = kctForever);
virtual void Post(Message *pmsg, int idCoalesce = -1);
virtual void Post(Message *pmsg, int idCoalesce = -1, bool fEvenIfStopping = false);
virtual void Post(int id, MessageHandler *handler,
MessageData *data = NULL) {
Message msg;

View File

@ -89,7 +89,7 @@ void HostSuspendModalLoop(DibBitmap *pbm)
break;
}
if (msg.id == kidmAppTerminate) {
thread.Post(&msg);
thread.Post(&msg, -1, true);
break;
}
thread.Dispatch(&msg);
@ -129,8 +129,8 @@ bool ProcessMessage(base::Message *pmsg, Event *pevt)
case kidmMouseMove2:
pevt->eType = penMoveEvent2;
pevt->ff = kfEvtFinger;
break;
break;
case kidmAppTerminate:
pevt->eType = appStopEvent;
pevt->ff = 0;