Permalink
Browse files

Made the scripting engine singleton be destroyed last to try and fix …

…certain crash cases.

I did that with the hope that it will prevent certain crashes due to luabind::object
not destroyed when the lua state is closed, according to:
http://sylefeb.blogspot.ch/2010/08/luabind-global-tables-of-classes.html

Related to #15.
  • Loading branch information...
1 parent 2f96bd9 commit 72cc2f486a6793172e0e8ec8c2e99adaf5e9829b Yohann Ferreira committed Nov 14, 2012
Showing with 4 additions and 2 deletions.
  1. +2 −1 src/editor/editor.cpp
  2. +2 −1 src/main.cpp
View
3 src/editor/editor.cpp
@@ -100,8 +100,9 @@ Editor::~Editor()
delete _undo_stack;
- ScriptEngine::SingletonDestroy();
VideoEngine::SingletonDestroy();
+ // Do it last since all luabind objects must be freed before closing the lua state.
+ ScriptEngine::SingletonDestroy();
}
View
3 src/main.cpp
@@ -85,9 +85,10 @@ void QuitApp()
GUISystem::SingletonDestroy();
AudioEngine::SingletonDestroy();
InputEngine::SingletonDestroy();
- ScriptEngine::SingletonDestroy();
SystemEngine::SingletonDestroy();
VideoEngine::SingletonDestroy();
+ // Do it last since all luabind objects must be freed before closing the lua state.
+ ScriptEngine::SingletonDestroy();
} // void QuitApp()
/** \brief Reads in all of the saved game settings and sets values in the according game manager classes

0 comments on commit 72cc2f4

Please sign in to comment.