Merge pull request #282 from dxx-rebirth/demo_fix

Fix freeze when aborting game while demo is recording
This commit is contained in:
kreatordxx 2016-12-08 13:22:24 +08:00 committed by GitHub
commit 62abd810a4

View file

@ -1212,6 +1212,8 @@ namespace dsx {
// Event handler for the game // Event handler for the game
window_event_result game_handler(window *,const d_event &event, const unused_window_userdata_t *) window_event_result game_handler(window *,const d_event &event, const unused_window_userdata_t *)
{ {
const bool was_game_wind = Game_wind != nullptr;
switch (event.type) switch (event.type)
{ {
case EVENT_WINDOW_ACTIVATED: case EVENT_WINDOW_ACTIVATED:
@ -1304,8 +1306,8 @@ window_event_result game_handler(window *,const d_event &event, const unused_win
break; break;
} }
// If we deleted the window, tell the event loop // If we deleted the window ***in this call of the handler***, tell the event loop
return Game_wind ? window_event_result::ignored : window_event_result::deleted; return Game_wind || !was_game_wind ? window_event_result::ignored : window_event_result::deleted;
} }
// Initialise game, actually runs in main event loop // Initialise game, actually runs in main event loop