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:
parent
3baa9aa3cd
commit
be60b541ad
@ -985,8 +985,11 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
|
||||
}
|
||||
|
||||
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 needsWorkaround = false;
|
||||
|
||||
@ -1038,11 +1041,6 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
|
||||
return true;
|
||||
}
|
||||
|
||||
QOpenGLContextPrivate::setCurrentContext(previous);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
Convenience function for calling makeCurrent with a 0 surface.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user