aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-02-26 16:56:22 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-03 19:43:14 +0100
commit84c41e4c7e22774e18d1462fcf4ca907a960900c (patch)
treedbf52fde3f03e30c20485907f0c2dd84873cb9e0 /src/quick
parent15e58df3386b5438f6ae114a51ad4a258085e70b (diff)
Do not print out leaked pixmaps by default
Change-Id: Id112def9710efa943ffc5350a25d40d4c4f463a1 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/util/qquickpixmapcache.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 7a9bea3aa0..0033be82be 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -78,6 +78,11 @@
QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_DEBUG
+static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty();
+#endif
+
// The cache limit describes the maximum "junk" in the cache.
static int cache_limit = 2048 * 1024; // 2048 KB cache limit for embedded in qpixmapcache.cpp
@@ -741,7 +746,9 @@ QQuickPixmapStore::~QQuickPixmapStore()
{
m_destroying = true;
+#ifndef QT_NO_DEBUG
int leakedPixmaps = 0;
+#endif
QList<QQuickPixmapData*> cachedData = m_cache.values();
// Prevent unreferencePixmap() from assuming it needs to kick
@@ -753,7 +760,9 @@ QQuickPixmapStore::~QQuickPixmapStore()
foreach (QQuickPixmapData* pixmap, cachedData) {
int currRefCount = pixmap->refCount;
if (currRefCount) {
+#ifndef QT_NO_DEBUG
leakedPixmaps++;
+#endif
while (currRefCount > 0) {
pixmap->release();
currRefCount--;
@@ -766,8 +775,10 @@ QQuickPixmapStore::~QQuickPixmapStore()
shrinkCache(20);
}
- if (leakedPixmaps)
+#ifndef QT_NO_DEBUG
+ if (leakedPixmaps && qsg_leak_check)
qDebug("Number of leaked pixmaps: %i", leakedPixmaps);
+#endif
}
void QQuickPixmapStore::unreferencePixmap(QQuickPixmapData *data)