crash on destroy_display in OSX 10.9
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
this->display = al_create_display(
3 if (!
std::runtime_error("failed to create display!");
5 if (!al_init_image_addon())
std::runtime_error("Failed to initialize al_init_image_addon!");
boost::filesystem::path windowIconPath =
global->paths->graphics / "factorio-icon.png";
this->windowIcon = al_load_bitmap(
10 if (!
ssprintf("Failed to load window icon! Loading from: %s"
this->display, ssprintf("Factorio %s"
14 if (!al_install_keyboard())
std::runtime_error("failed to initialize the keyboard!");
16 if (!al_install_mouse())
std::runtime_error("failed to initialize the mouse!");
19 if (!al_init_ttf_addon())
std::runtime_error("failed to initialize the ttf addon!");
21 if (!al_init_primitives_addon())
std::runtime_error("failed to load primitives addon!");
23 if (!al_install_audio())
std::runtime_error("Failed to install audio!");
25 if (!al_init_acodec_addon())
std::runtime_error("Failed to initialize audio codecs!");
27 if (!al_reserve_samples(50))
std::runtime_error("Failed to reserve samples!");
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.
Thread #613627. Printed from Allegro.cc
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.