diff options
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 4 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 1 | ||||
-rw-r--r-- | src/opengl/qgl_qpa.cpp | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index be592153d2..406c784c5c 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -538,6 +538,7 @@ bool QOpenGLContext::create() */ void QOpenGLContext::destroy() { + deleteQGLContext(); Q_D(QOpenGLContext); if (d->platformGLContext) emit aboutToBeDestroyed(); @@ -984,6 +985,9 @@ void *QOpenGLContext::qGLContextHandle() const } /*! + internal: If the delete function is specified QOpenGLContext "owns" + the passed context handle and will use the delete function to destroy it. + \internal */ void QOpenGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *)) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 22fc3f4ad0..ac4b6d2acc 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -242,6 +242,7 @@ public: void swapRegion(const QRegion ®ion); QOpenGLContext *guiGlContext; + // true if QGLContext owns the QOpenGLContext (for who deletes who) bool ownContext; void setupSharing(); diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 90ba0e7f5a..6194f82922 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -135,7 +135,7 @@ bool QGLFormat::hasOpenGL() ->hasCapability(QPlatformIntegration::OpenGL); } -void qDeleteQGLContext(void *handle) +static void qDeleteQGLContext(void *handle) { QGLContext *context = static_cast<QGLContext *>(handle); delete context; @@ -177,7 +177,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) d->valid = d->guiGlContext->create(); if (d->valid) - d->guiGlContext->setQGLContextHandle(this,qDeleteQGLContext); + d->guiGlContext->setQGLContextHandle(this, 0); d->glFormat = QGLFormat::fromSurfaceFormat(d->guiGlContext->format()); d->setupSharing(); |