HomeWildfire Games

Stop the random map generation upon quit request (Alt+F4), refs #4822.
AuditedrP21264

Description

Stop the random map generation upon quit request (Alt+F4), refs #4822.

Differential Revision: https://code.wildfiregames.com/D1304
Discussed with: Yves

Event Timeline

wraitii raised a concern with this commit.EditedMay 5 2018, 8:43 PM
wraitii added a subscriber: wraitii.

This basically breaks random maps on OSX with a crashing error. The reason is that the callback is called from the map worker thread, and SDL_QuitRequested calls SDL_PollEvent, and OSX crashes when a secondary thread tries to poll events.

Not sure if it's easily fixable or if we basically need to #ifdef this for OSX (as in general calling force-quit on an app kills it directly).

(edit: it only breaks random maps as I think we use JS enough that it runs a GC? thus running the callback).

This commit now has outstanding concerns.May 5 2018, 8:43 PM
elexis requested verification of this commit.May 8 2018, 12:05 PM

My mistake, I should have realized myself that pulling events of the mainthread from within a secondary thread can't be thread-safe and it was printed in the documentation. Now I know. Thanks for finding out quickly what was wrong, I had no chance to reproduce!
Should be fixed by rP21818.

This commit now requires verification by auditors.May 8 2018, 12:05 PM
wraitii accepted this commit.May 10 2018, 7:34 PM

Indeed, as you noted this already bit us in the past so I had a pretty good idea what was wrong. Thanks for the cleanup and the patch!

All concerns with this commit have now been addressed.May 10 2018, 7:34 PM