Skip to content

Commit

Permalink
Fix grabbing to wait until the image has actually been grabbed.
Browse files Browse the repository at this point in the history
Change-Id: I3535c57b5d8dd99c8a6cf24ccb1b56af298fcfe6
Reviewed-by: Martin Jones <martin.jones@nokia.com>
  • Loading branch information
Michael Brasser authored and Qt by Nokia committed Mar 19, 2012
1 parent 20ffaaf commit 6500e8c
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/quick/items/qquickwindowmanager.cpp
Expand Up @@ -107,11 +107,6 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_
lock. This variable is an integer to allow for recursive calls to lockInGui()
without using a recursive mutex. See isPostingSyncEvent.
RenderThread::isPaintComplete: This variable is cleared when rendering starts and
set once rendering is complete. It is monitored in the paintEvent(),
resizeEvent() and grab() functions to force them to wait for rendering to
complete.
RenderThread::isPostingSyncEvent: This variable is set in the render thread just
before the sync event is sent to the GUI thread. It is used to avoid deadlocks
in the case where render thread waits while waiting for GUI to pick up the sync
Expand Down Expand Up @@ -160,7 +155,6 @@ class QQuickRenderThreadSingleContextWindowManager : public QThread, public QQui
, allowMainThreadProcessingFlag(false)
, isGuiLocked(0)
, animationRunning(false)
, isPaintCompleted(false)
, isPostingSyncEvent(false)
, isRenderBlocked(false)
, isExternalUpdatePending(false)
Expand Down Expand Up @@ -248,7 +242,6 @@ public slots:

int isGuiLocked;
uint animationRunning: 1;
uint isPaintCompleted : 1;
uint isPostingSyncEvent : 1;
uint isRenderBlocked : 1;
uint isExternalUpdatePending : 1;
Expand Down Expand Up @@ -723,8 +716,6 @@ void QQuickRenderThreadSingleContextWindowManager::run()

handleRemovedWindows();

isPaintCompleted = true;

// Update sizes...
for (QHash<QQuickCanvas *, CanvasData *>::const_iterator it = m_rendered_windows.constBegin();
it != m_rendered_windows.constEnd(); ++it) {
Expand Down Expand Up @@ -1077,8 +1068,7 @@ QImage QQuickRenderThreadSingleContextWindowManager::grab(QQuickCanvas *canvas)
exhaustSyncEvent();

canvasToGrab = canvas;
isPaintCompleted = false;
while (isRunning() && !isPaintCompleted) {
while (isRunning() && canvasToGrab) {
if (isRenderBlocked)
wake();
wait();
Expand Down

0 comments on commit 6500e8c

Please sign in to comment.