[loading window] Let's try to dodge a crash when existing while reloading songs.

This commit is contained in:
Henrik Andersson
2011-06-05 22:54:45 +02:00
parent 4a11952986
commit 50e180851e
2 changed files with 10 additions and 1 deletions
+8 -1
View File
@@ -15,6 +15,8 @@
* computer while songs load. */
REGISTER_SCREEN_CLASS( ScreenReloadSongs );
ScreenReloadSongs::ScreenReloadSongs() : loadComplete(false) {}
void ScreenReloadSongs::Init()
{
Screen::Init();
@@ -33,7 +35,11 @@ void ScreenReloadSongs::Init()
ScreenReloadSongs::~ScreenReloadSongs()
{
//m_loadingThread.Halt(true);
if(!loadComplete) {
//we where going to crash if we let this one lose, so "only"
//leaving stuff possibly corrupted isn't worse.
m_loadingThread.Halt(true);
}
RemoveChild(loadWin);
delete loadWin;
}
@@ -45,6 +51,7 @@ int ScreenReloadSongs::loadingThreadProc(void *thisAsVoidPtr) {
SONGMAN->Reload( false );
SCREENMAN->PostMessageToTopScreen( SM_GoToNextScreen, 0 );
self->loadComplete=true;
return 0;
}
+2
View File
@@ -9,9 +9,11 @@ class InGameLoadingWindow;
class ScreenReloadSongs: public Screen
{
public:
ScreenReloadSongs();
virtual void Init();
~ScreenReloadSongs();
private:
bool loadComplete;
InGameLoadingWindow *loadWin;
RageThread m_loadingThread;
static int loadingThreadProc(void *thisAsVoidPtr);