From: lordmulder Date: Fri, 23 Mar 2012 00:29:50 +0000 (+0100) Subject: Better workaround for the previous commit. X-Git-Tag: Release_404~53 X-Git-Url: http://git.osdn.net/view?p=lamexp%2FLameXP.git;a=commitdiff_plain;h=2da05e2324cf6f53d632c044e1d093976cd174e5 Better workaround for the previous commit. --- diff --git a/src/Config.h b/src/Config.h index c1f22fb2..bfa71ac9 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 7 -#define VER_LAMEXP_BUILD 914 +#define VER_LAMEXP_BUILD 915 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Dialog_SplashScreen.cpp b/src/Dialog_SplashScreen.cpp index d68df630..31662442 100644 --- a/src/Dialog_SplashScreen.cpp +++ b/src/Dialog_SplashScreen.cpp @@ -38,7 +38,8 @@ //////////////////////////////////////////////////////////// SplashScreen::SplashScreen(QWidget *parent) - : QFrame(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint) +: + QFrame(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint) { //Init the dialog, from the .ui file setupUi(this); @@ -118,16 +119,13 @@ void SplashScreen::showSplash(QThread *thread) timer->start(30720); //Loop while thread is still running - while(thread->isRunning()) + bool bStillRunning = threadStillRunning(thread); + while(bStillRunning) { loop->exec(); - if(thread->isRunning()) + if(bStillRunning = threadStillRunning(thread)) { - QThread::yieldCurrentThread(); - if(thread->isRunning()) - { - qWarning("Potential deadlock in initialization thread!"); - } + qWarning("Potential deadlock in initialization thread!"); } } @@ -179,3 +177,21 @@ bool SplashScreen::winEvent(MSG *message, long *result) { return WinSevenTaskbar::handleWinEvent(message, result); } + +//////////////////////////////////////////////////////////// +// HELPER FUNCTIONS +//////////////////////////////////////////////////////////// + +bool SplashScreen::threadStillRunning(const QThread *thread) +{ + for(int i = 0; i < 128; i++) + { + if(!(thread->isRunning())) + { + return false; + } + QThread::yieldCurrentThread(); + } + + return thread->isRunning(); +} diff --git a/src/Dialog_SplashScreen.h b/src/Dialog_SplashScreen.h index 8c3df28f..f30b38ab 100644 --- a/src/Dialog_SplashScreen.h +++ b/src/Dialog_SplashScreen.h @@ -41,6 +41,8 @@ private: QMovie *m_working; bool m_canClose; + static inline bool threadStillRunning(const QThread *thread); + protected: void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event);