Use a mutex to make sure all command objects have completed before issuing snapshots in the regression tests.

p4#: 22400
This commit is contained in:
Magne Sjaastad
2013-09-13 09:23:33 +02:00
parent 1543f05794
commit 74b6b858d3
2 changed files with 20 additions and 0 deletions

View File

@@ -356,6 +356,10 @@ bool RiaApplication::loadProject(const QString& projectFileName)
m_commandQueue.push_back(m_project->commandObjects[i]);
}
// Lock the command queue
m_commandQueueLock.lock();
// Execute command objects, and release the mutex when the queue is empty
executeCommandObjects();
onProjectOpenedOrClosed();
@@ -1374,6 +1378,14 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
if (testCaseFolder.exists(regTestProjectName))
{
loadProject(testCaseFolder.filePath(regTestProjectName));
// Wait until all command objects have completed
while (!m_commandQueueLock.tryLock())
{
processEvents();
}
m_commandQueueLock.unlock();
saveSnapshotForAllViews(generatedFolderName);
QDir baseDir(testCaseFolder.filePath(baseFolderName));
@@ -1716,5 +1728,10 @@ void RiaApplication::executeCommandObjects()
m_commandQueue.pop_front();
}
else
{
// Unlock the command queue lock when the command queue is empty
m_commandQueueLock.unlock();
}
}