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/items/qquickitem.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/items/qquickitem.cpp')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 26af6953e1..ad8a9d90af 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -78,6 +78,10 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_DEBUG +static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty(); +#endif + #ifdef FOCUS_DEBUG void printFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1); void printFocusTree(QQuickItem *item, QQuickItem *scope, int depth) @@ -1965,9 +1969,11 @@ static void qt_print_item_count() QQuickItem::~QQuickItem() { #ifndef QT_NO_DEBUG - --qt_item_count; - if (qt_item_count < 0) - qDebug("Item destroyed after qt_print_item_count() was called."); + if (qsg_leak_check) { + --qt_item_count; + if (qt_item_count < 0) + qDebug("Item destroyed after qt_print_item_count() was called."); + } #endif Q_D(QQuickItem); @@ -2546,11 +2552,13 @@ QQuickItemPrivate::~QQuickItemPrivate() void QQuickItemPrivate::init(QQuickItem *parent) { #ifndef QT_NO_DEBUG - ++qt_item_count; - static bool atexit_registered = false; - if (!atexit_registered) { - atexit(qt_print_item_count); - atexit_registered = true; + if (qsg_leak_check) { + ++qt_item_count; + static bool atexit_registered = false; + if (!atexit_registered) { + atexit(qt_print_item_count); + atexit_registered = true; + } } #endif |