On Mac OSX 10.9 everytime when Factorio (www.factorio.com) tries to destroy the display there comes the crash. This is only issue on that specific OS, it works fine on lower OSX versions as well as Win and Linux. The stacktrace can be found here (on the game forum): http://www.factorioforums.com/forum/viewtopic.php?f=7&t=1714 From the stack trace it looks like some sound routines are still running when destroying the display.
I am probably missing something in the destroy sequence. The destroy sequence was done mostly by trial and error mechanism:-[, so I suppose there can be plenty wrong. Here is the relevant code of the destroy sequence:
and here is the relevant part from the resources allocation
I played around with the OSX 10.9 machine for like an hour (I don't own one), but couldn't figure out what the problem was. I would appreciate any hints or ideas.
General recommendation for destroy ordering is FILO - first in last out. So destroy things in the reverse order you initialized them.
Since you shut down Allegro in a destructor you might want to ensure that the destructor is really only run when appropriate.
It could well be a bug in Allegro (if so, please fix). You might try not shutting down the addons individually and letting al_uninstall_system take care of it. al_uninstall_system is not strictly necessary either.