diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-02-20 14:21:53 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-20 19:41:44 +0100 |
commit | 8c8404f8153508106f65efb43110ba85c05e73bc (patch) | |
tree | 100690675de9ac65f9026269187ac63f81070805 /src/quick/scenegraph/coreapi/qsgnode.cpp | |
parent | bbc9008f077bccd811483608d9a436cce3e923f5 (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/qsgnode.cpp')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 5995dc862d..6a22e0e7f9 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_DEBUG +static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty(); static int qt_node_count = 0; static void qt_print_node_count() @@ -271,11 +272,13 @@ QSGNode::QSGNode(NodeType type) void QSGNode::init() { #ifndef QT_NO_DEBUG - ++qt_node_count; - static bool atexit_registered = false; - if (!atexit_registered) { - atexit(qt_print_node_count); - atexit_registered = true; + if (qsg_leak_check) { + ++qt_node_count; + static bool atexit_registered = false; + if (!atexit_registered) { + atexit(qt_print_node_count); + atexit_registered = true; + } } #endif } @@ -289,9 +292,11 @@ void QSGNode::init() QSGNode::~QSGNode() { #ifndef QT_NO_DEBUG - --qt_node_count; - if (qt_node_count < 0) - qDebug("Node destroyed after qt_print_node_count() was called."); + if (qsg_leak_check) { + --qt_node_count; + if (qt_node_count < 0) + qDebug("Node destroyed after qt_print_node_count() was called."); + } #endif destroy(); } |