MovingBlocks/Terasology — pull request #1291 by Cervator (2014-10-18 02:44:29+00:00)
Title: More cleanup

Inspired by #1288 (cleans up better on initialization crashes) I tried to add cleanup() to another spot in the engine to catch crashes during normal runtime. It *looks* like it fixes another big piece of #1266 and games close correctly. CrashReporter still reports the correct thing, even if a crash happens during cleanup itself.

I'm not super confident in doing changes this fundamental, feels like I must be missing something! Or is it really this simple?

One quirk: If a crash happens during cleanup the error may get reported twice (as cleanup is attempted again after the crash mid-cleanup ...). CR still gets the right message so oh well. Game may still not dispose correctly depending on where the crash happens during cleanup (a simulated crash before stopThreads() for instance still leaves a broken process. CR still triggers correctly even then

Also noticed that the CrashGameBlock in Sample will actually crash the server even if triggered by a client (which then actually gets disconnected instead). CR pops up on the server if enabled, heh. Not sure how to make the client crash without taking down the server.

Thanks for the inspiration @msteiger :D

(also reformatted a couple prefabs as the red squiggly kept nagging me)