macOS: Clarify what static mutex in QCocoaGLContext is used for

Change-Id: I4af0b78dbecad40b2a73cdbdb09a8eb60efdb013
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-09-13 13:33:29 +02:00
parent 0d1481b4d2
commit 2c649856d5

View File

@ -393,8 +393,10 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
return true;
}
// NSOpenGLContext is not re-entrant (https://openradar.appspot.com/37064579)
static QMutex s_contextMutex;
// NSOpenGLContext is not re-entrant. Even when using separate contexts per thread,
// view, and window, calls into the API will still deadlock. For more information
// see https://openradar.appspot.com/37064579
static QMutex s_reentrancyMutex;
void QCocoaGLContext::update()
{
@ -403,7 +405,7 @@ void QCocoaGLContext::update()
// render-loop that doesn't return to one of the outer pools.
QMacAutoReleasePool pool;
QMutexLocker locker(&s_contextMutex);
QMutexLocker locker(&s_reentrancyMutex);
qCInfo(lcQpaOpenGLContext) << "Updating" << m_context << "for" << m_context.view;
[m_context update];
}
@ -422,7 +424,7 @@ void QCocoaGLContext::swapBuffers(QPlatformSurface *surface)
return;
}
QMutexLocker locker(&s_contextMutex);
QMutexLocker locker(&s_reentrancyMutex);
[m_context flushBuffer];
}