From b1dcdc406446a5e1eb5a7e04d984fed91ceb52ec Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Tue, 5 Jan 2016 15:17:11 +0100 Subject: [PATCH] Avoid unnecessary detaching of the pending deletions list. This code seems to be hit three times per frame in a hybrid QQ2/Qt3D app, quickly generating thousands of allocations here via the detach in begin(). Heaptrack confirms they are all gone now. Change-Id: I7d09f3f5c2b24a2590b701216715055751306e82 Reviewed-by: Sean Harmer Reviewed-by: Marc Mutz --- src/gui/kernel/qopenglcontext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 85d05959def..3c033ea39e1 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1459,11 +1459,11 @@ void QOpenGLContextGroupPrivate::deletePendingResources(QOpenGLContext *ctx) { QMutexLocker locker(&m_mutex); - QList pending = m_pendingDeletion; + const QList pending = m_pendingDeletion; m_pendingDeletion.clear(); - QList::iterator it = pending.begin(); - QList::iterator end = pending.end(); + QList::const_iterator it = pending.begin(); + QList::const_iterator end = pending.end(); while (it != end) { (*it)->freeResource(ctx); delete *it;