From b3da7494ba827055f1cf34d9aa20724a464bc95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 1 Aug 2018 16:23:58 +0200 Subject: macOS: Don't make QCocoaGLContext current unless we have a drawable Change-Id: I12ac982aa977c69af936f503369c91bac88492a9 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 47ad930cf6..4d0fa2e28e 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -333,10 +333,10 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) Q_ASSERT(surface->surface()->supportsOpenGL()); - [m_context makeCurrentContext]; - - if (surface->surface()->surfaceClass() == QSurface::Offscreen) + if (surface->surface()->surfaceClass() == QSurface::Offscreen) { + [m_context makeCurrentContext]; return true; + } QWindow *window = static_cast(surface)->window(); if (!setActiveWindow(window)) { @@ -344,6 +344,8 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) return false; } + [m_context makeCurrentContext]; + // Disable high-resolution surfaces when using the software renderer, which has the // problem that the system silently falls back to a to using a low-resolution buffer // when a high-resolution buffer is requested. This is not detectable using the NSWindow -- cgit v1.2.3