Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.9.1
-
None
-
fcbaa8ec385e796c18cf317e8f364bd8e3c2538b (qtbase/5.9, 9.1.2018, 5.9.4)
Description
On windows, the following code causes an assert in QFileSystemModelPrivate::addNode. This is just an easy way to reproduce a problem that can have severe consequences.
For instance, I use a QSortFilterProxyModel::filterAcceptsRow and in certain cases, my overriden function is called recursively, causing sometimes a crash.
#include <QApplication> #include <qfilesystemmodel> int main(int argc, char* argv[]) { QApplication app(argc, argv); QFileSystemModel model; model.setRootPath(QLatin1String("\\\\MACPRO\\Data")); model.setRootPath(QLatin1String("\\\\MACPRO\\Data")); }
The root of the problem is in QFileSystemModelPrivate::node (and maybe elsewhere) where the case sensitivity of the file system is not taken in account,
There is this line:
if (!root.children.contains(host.toLower())) {
while in other parts of the file, the case sensitivity is taken into account, eg.
if ((parent->children.count() == 0)
|| (parent->caseSensitive()
&& parent->children.value(element)->fileName != element)
|| (!parent->caseSensitive()
&& parent->children.value(element)->fileName.toLower() != element.toLower()))
[EDIT] there are other reports that seem to be related. But here my little sample is very easy to test.
QTBUG-21278, QTBUG-31103, QTBUG-61786, QTBUG-17750
Attachments
Issue Links
- relates to
-
QTBUG-21278 QFileSystemModel (temporarily) contains duplicate entries
- Reported
-
QTBUG-31103 QFileSystemModel need to better case insensitivity support
- Open
-
QTBUG-17750 QFileDialog on windows requires case correct UNC path
- Closed