diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-09-30 11:54:54 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-09-30 23:16:45 +0000 |
commit | 8a25006fad013f75454d78d976ad02ed7f0f530c (patch) | |
tree | 2d2c49c3c1c3a17b115b0fe411d770a011679a93 /src/widgets/dialogs | |
parent | b5662ba6037cd27cbf276922c376a1192ba7c51e (diff) |
QFileSystemModel: add an assert to prevent leaks
Private::addNode() adds the new node to the parent's hash without
checking whether a node already exists. If it does, then the old
node is leaked.
Add an assertion to check for this condition.
Change-Id: Ib949d71c86c28d1152a538756c0efc283c793c24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index b27cfa5805..d2b909d201 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -1698,6 +1698,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile node->volumeName = QString::fromWCharArray(name); } #endif + Q_ASSERT(!parentNode->children.contains(fileName)); parentNode->children.insert(fileName, node); return node; } |