From: Marco Costalba Date: Sun, 25 Apr 2010 09:31:48 +0000 (+0100) Subject: Do not call exit_threads() in Application d'tor X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=fb0e19dc8bcd770db4f627b90697f29965151429;hp=fb0e19dc8bcd770db4f627b90697f29965151429 Do not call exit_threads() in Application d'tor Because exit_threads() references the global object TM, we need to call the function when still inside main(), otherwise, due to undefined global object initialization and destruction we could end up with referencing an already destroyed object. Actually this should not happen because Application singleton is initialized _only_ after all the other globals due to how Application::initialize() is defined, but this is very tricky C++ and not easy to follow, even for me ;-) Also rearranged a bit main() code flow. No functional change. Signed-off-by: Marco Costalba ---