Better workaround for the previous commit.

This commit is contained in:
LoRd_MuldeR 2012-03-23 01:29:50 +01:00
parent 18094c66f0
commit 2da05e2324
3 changed files with 27 additions and 9 deletions

View File

@ -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!)

View File

@ -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();
}

View File

@ -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);