summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-08-01 16:23:58 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-08-04 19:59:38 +0000
commitb3da7494ba827055f1cf34d9aa20724a464bc95b (patch)
treea0a8c25de2fd742e4d8ebf04065e9ddbb3f25d35 /src/plugins/platforms/cocoa
parentc5a5d270e4b1f2de8b1628dfb13f5aa457e980b7 (diff)
macOS: Don't make QCocoaGLContext current unless we have a drawable
Change-Id: I12ac982aa977c69af936f503369c91bac88492a9 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm8
1 files changed, 5 insertions, 3 deletions
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<QCocoaWindow *>(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