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>bb10
parent
b5662ba603
commit
8a25006fad
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue