From 5f24d8930838f0d3cb622f9937a171eb6734df1a Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 10 Sep 2009 07:24:55 +0200 Subject: Fixed crash on shutdown with GL when leaking QGLWidgets The problem was the QGLContextResource destructor which was called when the QtOpenGL dll was unloaded. At this point in time, the gl driver had already been unloaded so any gl calls at this point in time would crash. It is simply wrong for the destructor to try to clean up, so we instead output a warning if resources are leaked. --- src/opengl/qgl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 3e30fe4..65d6f99 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4916,8 +4916,13 @@ QGLContextResource::QGLContextResource(FreeFunc f, QObject *parent) QGLContextResource::~QGLContextResource() { - while (!m_resources.empty()) - removeGroup(m_resources.begin().key()); +#ifndef QT_NO_DEBUG + if (m_resources.size()) { + qWarning("QtOpenGL: Resources are still available at program shutdown.\n" + " This is possibly caused by a leaked QGLWidget, \n" + " QGLFrameBufferObject or QGLPixelBuffer."); + } +#endif } void QGLContextResource::insert(const QGLContext *key, void *value) -- cgit v0.12