summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Fries <David@Fries.net>2014-07-17 15:23:26 -0500
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-08-05 17:30:03 +0200
commit3a347a4e70e5a10ee92dd2578316c926a399e894 (patch)
tree119daca696d138c5fea7489fa0f54fa98abad0cf /src/gui
parente1fed5dc3156f32f22d78dc57fa5ab8fcedaa804 (diff)
OpenGL: destroy QGLContext allocated by QGLContext::fromOpenGLContext
QGLContext already uses ownContext to identify when it "owns" QOpenGLContext and will delete QOpenGLContext when needed. In the other way QGLContext::fromOpenGLContext creates a QGLContext for QOpenGLContext, and is now using qGLContextDeleteFunction to identify if QOpenGLContext "owns" QGLContext by QGLContext only passing a delete function when QOpenGLContext should delete QGLContext, and by QOpenGLContext calling deleteQGLContext() from destory() to do the destruction avoiding the previous leak and sometimes crash on exit. Change-Id: I65e791776e99b456e4d0c70fc5b5cdb33c975893 Task-number: QTBUG-40286 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qopenglcontext.cpp4
1 files changed, 4 insertions, 0 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 *))