summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2010-12-13 17:06:19 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2010-12-13 17:49:11 (GMT)
commit496a3f83138e807150f2ff06f5462f7f9ab519fc (patch)
tree31255a5864d477b2db87708ee1c245ba2bd1bbe2 /src/corelib
parent14f4ebce80ec7d39287b445192b25111a49fff6b (diff)
downloadQt-496a3f83138e807150f2ff06f5462f7f9ab519fc.zip
Qt-496a3f83138e807150f2ff06f5462f7f9ab519fc.tar.gz
Qt-496a3f83138e807150f2ff06f5462f7f9ab519fc.tar.bz2
Don't rely on uninitialized data
When we fail to get file attributes, the file times are left in an uninitialized state, which may lead to a crash. In particular, this was showing up in QMessageBox's autotest, where the lastModified time is being queried on a non-existing file. Before the refactoring, we were returning a default constructed QDateTime to queries about different file times, with this change we will return the time corresponding to a default constructed FILETIME object. Reviewed-by: Shane Kearns
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 39fce97..b7bded9 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -433,6 +433,9 @@ void QFileSystemEngine::clearWinStatData(QFileSystemMetaData &data)
{
data.size_ = 0;
data.fileAttribute_ = 0;
+ data.creationTime_ = FILETIME();
+ data.lastAccessTime_ = FILETIME();
+ data.lastWriteTime_ = FILETIME();
}
bool QFileSystemEngine::isCaseSensitive()