aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgmaterial.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-02-20 14:21:53 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-20 19:41:44 +0100
commit8c8404f8153508106f65efb43110ba85c05e73bc (patch)
tree100690675de9ac65f9026269187ac63f81070805 /src/quick/scenegraph/coreapi/qsgmaterial.cpp
parentbbc9008f077bccd811483608d9a436cce3e923f5 (diff)
Don't print leak warnings on exit by default
Task-number: QTBUG-29780 Change-Id: I6f35253dbec6346af239c0ab341caad9f4f9b862 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgmaterial.cpp')
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index 0e40a01311..f678504344 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -44,6 +44,10 @@
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_DEBUG
+static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty();
+#endif
+
/*!
\group qtquick-scenegraph-materials
\title Qt Quick Scene Graph Material Classes
@@ -538,11 +542,13 @@ QSGMaterial::QSGMaterial()
: m_flags(0)
{
#ifndef QT_NO_DEBUG
- ++qt_material_count;
- static bool atexit_registered = false;
- if (!atexit_registered) {
- atexit(qt_print_material_count);
- atexit_registered = true;
+ if (qsg_leak_check) {
+ ++qt_material_count;
+ static bool atexit_registered = false;
+ if (!atexit_registered) {
+ atexit(qt_print_material_count);
+ atexit_registered = true;
+ }
}
#endif
}
@@ -555,9 +561,11 @@ QSGMaterial::QSGMaterial()
QSGMaterial::~QSGMaterial()
{
#ifndef QT_NO_DEBUG
- --qt_material_count;
- if (qt_material_count < 0)
- qDebug("Material destroyed after qt_print_material_count() was called.");
+ if (qsg_leak_check) {
+ --qt_material_count;
+ if (qt_material_count < 0)
+ qDebug("Material destroyed after qt_print_material_count() was called.");
+ }
#endif
}