Commit a4eb74c9 authored by Clinton Stimpson's avatar Clinton Stimpson

BUG: Make pqEventDispatcher::processEventsAndWait() thread-safe.

parent c56e1146
......@@ -41,6 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QTimer>
#include <QApplication>
#include <QEventLoop>
#include <QThread>
////////////////////////////////////////////////////////////////////////////
// pqEventDispatcher::pqImplementation
......@@ -198,10 +199,18 @@ void pqEventDispatcher::stopPlayback()
void pqEventDispatcher::processEventsAndWait(int ms)
{
pqEventDispatcher::pqImplementation::WaitTime = ms <= 0 ? 1 : ms;
if(QThread::currentThread() == qApp->thread())
{
pqEventDispatcher::pqImplementation::WaitTime = ms <= 0 ? 1 : ms;
}
QEventLoop loop;
QTimer::singleShot(ms, &loop, SLOT(quit()));
loop.exec();
pqEventDispatcher::pqImplementation::WaitTime = 0;
if(QThread::currentThread() == qApp->thread())
{
pqEventDispatcher::pqImplementation::WaitTime = 0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment