diff options
Diffstat (limited to 'src/gui/kernel/qopenglcontext.cpp')
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index f6481d3bb0..1b6d1d34c4 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -288,6 +288,12 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) if (!surface->surfaceHandle()) return false; + if (surface->surfaceType() != QSurface::OpenGLSurface) { + qWarning() << "QOpenGLContext::makeBuffers() called with non-opengl surface"; + return false; + } + + if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) { QOpenGLContextPrivate::setCurrentContext(this); d->surface = surface; @@ -354,6 +360,11 @@ void QOpenGLContext::swapBuffers(QSurface *surface) return; } + if (surface->surfaceType() != QSurface::OpenGLSurface) { + qWarning() << "QOpenGLContext::swapBuffers() called with non-opengl surface"; + return; + } + QPlatformSurface *surfaceHandle = surface->surfaceHandle(); if (!surfaceHandle) return; |