Skip to content

Commit 83c8956

Browse files
tore29OmniBlade
authored andcommitted
Fixes the TD process hanging when pressing 'exit game'
1 parent 59efc89 commit 83c8956

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

tiberiandawn/startup.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,27 @@ int main(int argc, char** argv)
467467
Memory_Error_Exit = Print_Error_Exit;
468468

469469
CCDebugString("C&C95 - About to exit.\n");
470-
ReadyToQuit = 1;
471470

472471
#if defined(SDL_BUILD)
473472
Reset_Video_Mode();
474473
#endif
475474

476475
Sound_End();
477476

478-
#if defined(_WIN32)
479-
PostMessageA(MainWindow, WM_DESTROY, 0, 0);
477+
/*
478+
** Flag that this is a clean shutdown (not killed with Ctrl-Alt-Del)
479+
*/
480+
ReadyToQuit = 1;
481+
482+
/*
483+
** Post a message to our message handler to tell it to clean up.
484+
*/
485+
#if defined(_WIN32) && !defined(SDL_BUILD)
486+
PostMessage(MainWindow, WM_DESTROY, 0, 0);
487+
488+
/*
489+
** Wait until the message handler has dealt with the message
490+
*/
480491
do {
481492
Keyboard->Check();
482493
} while (ReadyToQuit == 1);
@@ -598,4 +609,4 @@ void Read_Setup_Options(RawFileClass* config_file)
598609
*/
599610
VideoBackBufferAllowed = ini.Get_Bool("Options", "VideoBackBuffer", true);
600611
AllowHardwareBlitFills = ini.Get_Bool("Options", "HardwareFills", true);
601-
}
612+
}

0 commit comments

Comments
 (0)