Make QOpenGLContext::makeCurrent use early exit for all its flow

The case of the platform context failing makeCurrent is the exception.

Change-Id: I606e6fb379f84e886bff9e27355dda9b31ff9ebe
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-08-16 11:45:45 +02:00
parent 3baa9aa3cd
commit be60b541ad

View File

@ -985,8 +985,11 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
} }
QOpenGLContext *previous = QOpenGLContextPrivate::setCurrentContext(this); QOpenGLContext *previous = QOpenGLContextPrivate::setCurrentContext(this);
if (!d->platformGLContext->makeCurrent(surface->surfaceHandle())) {
QOpenGLContextPrivate::setCurrentContext(previous);
return false;
}
if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) {
static bool needsWorkaroundSet = false; static bool needsWorkaroundSet = false;
static bool needsWorkaround = false; static bool needsWorkaround = false;
@ -1038,11 +1041,6 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
return true; return true;
} }
QOpenGLContextPrivate::setCurrentContext(previous);
return false;
}
/*! /*!
Convenience function for calling makeCurrent with a 0 surface. Convenience function for calling makeCurrent with a 0 surface.