summaryrefslogtreecommitdiff
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-16 01:22:45 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-16 01:22:45 +0100
commit7075e291998612a3c0a530bb37a515dd07739e28 (patch)
tree4e1992498d82ee3f6f92fd6d42754c92928dd581 /src/gui/kernel
parent1161a8a62907796ea45b1877bec31e66aeef77f6 (diff)
parent3d9a40038f01bc2a3df0027a9be04e7fa3ce3850 (diff)
downloadqtbase-7075e291998612a3c0a530bb37a515dd07739e28.tar.gz
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/widgets/styles/qstyleanimation.cpp Change-Id: Iae570895be6544de80f9c1ec309d1a08c59daff8
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qopenglcontext.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index f16f29718d..96b09342c7 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -759,15 +759,26 @@ void QOpenGLContextGroupPrivate::removeContext(QOpenGLContext *ctx)
{
Q_Q(QOpenGLContextGroup);
- QMutexLocker locker(&m_mutex);
- m_shares.removeOne(ctx);
+ bool deleteObject = false;
+
+ {
+ QMutexLocker locker(&m_mutex);
+ m_shares.removeOne(ctx);
- if (ctx == m_context && !m_shares.isEmpty())
- m_context = m_shares.first();
+ if (ctx == m_context && !m_shares.isEmpty())
+ m_context = m_shares.first();
+
+ if (!m_refs.deref()) {
+ cleanup();
+ deleteObject = true;
+ }
+ }
- if (!m_refs.deref()) {
- cleanup();
- q->deleteLater();
+ if (deleteObject) {
+ if (q->thread() == QThread::currentThread())
+ delete q; // Delete directly to prevent leak, refer to QTBUG-29056
+ else
+ q->deleteLater();
}
}