summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-30 16:08:53 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-30 16:18:44 (GMT)
commitda3bf86ecea14a8658601803e14820a28e7470d6 (patch)
tree6a7f36735bf245d826711692a30ff5b6a31c76ec /tests/auto
parentb5bf6d68bdde5f5db1d72179f4e20dc1e21d20c4 (diff)
downloadQt-da3bf86ecea14a8658601803e14820a28e7470d6.zip
Qt-da3bf86ecea14a8658601803e14820a28e7470d6.tar.gz
Qt-da3bf86ecea14a8658601803e14820a28e7470d6.tar.bz2
Fixes a crash on Mac with QFileInfo.
realpath() crashes on mac if the input file path is the root ("/") - on 10.6 calling a free on the returned value shows a warning saying the memory was not allocated. To workaround that just added a special case - if the input string is '/', we don't need to use realpath as we already know that the path is canonical. Reviewed-by: Prasanth
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 21edbcf..cd58fd6 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -513,6 +513,10 @@ void tst_QFileInfo::canonicalFilePath()
QFileInfo info("/tmp/../../../../../../../../../../../../../../../../../");
info.canonicalFilePath();
+ // This used to crash on Mac
+ QFileInfo dontCrash(QLatin1String("/"));
+ QCOMPARE(dontCrash.canonicalFilePath(), QLatin1String("/"));
+
#ifndef Q_OS_WIN
// test symlinks
QFile::remove("link.lnk");