From f189bb458179630b26a5b93e06eacaa2a138b793 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 15 Nov 2013 15:28:33 +0100 Subject: Fix lockup in creator. My previous fix to force expose when the render thread is inactive was not enough. We now lock down access to 'QSGRenderThread::window' so that it will always be set when the thread is in the "exposed" state and 0 when the thread is in the "obscured" state. This introduces another sync point in handleObscurity to protect the writing of window in the render thread. Task-number: QTCREATORBUG-10793 Change-Id: I1e1153189b3a3562705892b42625f88ef6329188 Reviewed-by: Ulf Hermann Reviewed-by: Kai Koehne --- src/quick/scenegraph/qsgthreadedrenderloop.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp') diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 96dfd1c26f..0c46747e53 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -381,10 +381,13 @@ bool QSGRenderThread::event(QEvent *e) Q_ASSERT(!window || window == static_cast(e)->window); + mutex.lock(); if (window) { QSG_RT_DEBUG(" - removed one..."); window = 0; } + waitCondition.wakeOne(); + mutex.unlock(); return true; } @@ -799,7 +802,7 @@ void QSGThreadedRenderLoop::show(QQuickWindow *window) * * REF: QTCREATORBUG-10699 */ - if (window->isExposed() && (!w->thread || !w->thread->isRunning())) + if (window->isExposed() && (!w->thread || !w->thread->window)) handleExposure(w); return; } @@ -942,8 +945,12 @@ void QSGThreadedRenderLoop::handleExposure(Window *w) void QSGThreadedRenderLoop::handleObscurity(Window *w) { QSG_GUI_DEBUG(w->window, "handleObscurity"); - if (w->thread->isRunning()) + if (w->thread->isRunning()) { + w->thread->mutex.lock(); w->thread->postEvent(new WMWindowEvent(w->window, WM_Obscure)); + w->thread->waitCondition.wait(&w->thread->mutex); + w->thread->mutex.unlock(); + } startOrStopAnimationTimer(); } -- cgit v1.2.3