From 12e471b7fd254fa276f19f7c7c980b4cee9ba005 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 18 Oct 2011 12:06:24 +0300 Subject: [PATCH] Do not call swapBuffers when surfaceHandle is NULL. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calling swapBuffers with the surfaceHandle of 0 returned by QWindow during application exit causes a crash when using GLX. The patch avoids swapBuffer calls to platformGLContext when there is no surface handle anymore. Change-Id: I09c5bbafd4e7af6648ca54a58ed0267d0a2f343d Reviewed-by: Samuel Rødal --- src/gui/kernel/qopenglcontext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 2d7a62996c..b3ce22448d 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -290,7 +290,9 @@ void QOpenGLContext::swapBuffers(QSurface *surface) return; } - d->platformGLContext->swapBuffers(surface->surfaceHandle()); + QPlatformSurface *surfaceHandle = surface->surfaceHandle(); + if (surfaceHandle) + d->platformGLContext->swapBuffers(surfaceHandle); } void (*QOpenGLContext::getProcAddress(const QByteArray &procName)) ()