summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qopenglcontext.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2012-01-19 12:51:43 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-02 17:20:24 +0100
commit75711510b1ad7d4ac4434ad41a0ed71cfc0344dc (patch)
treefc8fae2ea9c623d76cb670e3b9cda9a0e125f573 /src/gui/kernel/qopenglcontext.cpp
parent6181676ca61f39f389a8c3ca293c369e7f80b1e8 (diff)
Improve QSurface / QWindow API a bit and use that to avoid errors
Change-Id: Iadba1c3a7b8e6bc7f145455132cefed2a905c11d Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui/kernel/qopenglcontext.cpp')
-rw-r--r--src/gui/kernel/qopenglcontext.cpp11
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;