Fix the problem with the thread that tried to access to a screen that could be deleted
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5834 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -114,8 +114,7 @@ void MainMenuScreen::init()
|
||||
input_manager->setMasterPlayerOnly(false);
|
||||
#ifdef ADDONS_MANAGER
|
||||
pthread_mutex_init(&(this->m_mutex_news_text), NULL);
|
||||
pthread_t nThreadID2;
|
||||
pthread_create(&nThreadID2, NULL, &MainMenuScreen::downloadNews, this);
|
||||
pthread_create(&m_thread_news_text, NULL, &MainMenuScreen::downloadNews, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -243,3 +242,10 @@ void * MainMenuScreen::downloadNews( void * pthis)
|
||||
}
|
||||
#endif
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
#ifdef ADDONS_MANAGER
|
||||
MainMenuScreen::~MainMenuScreen()
|
||||
{
|
||||
fprintf(stdout, "canceling the thread");
|
||||
pthread_cancel(m_thread_news_text);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
#ifdef ADDONS_MANAGER
|
||||
void changeNewsText(std::string action);
|
||||
pthread_mutex_t m_mutex_news_text;
|
||||
pthread_t m_thread_news_text;
|
||||
~MainMenuScreen();
|
||||
std::string m_news_text;
|
||||
void onUpdate(float delta, irr::video::IVideoDriver* driver);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user