Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
4.5.3
-
None
-
Windows XP SP3
Visual Studio 2005 (SP1)
Description
The static method QFile::rename() returns false if another QTemporaryFile object touched the corresponding file before, although it has been closed before.
The following code is a compressed snipped:
QString sTempPath = QDir::tempPath();
QTemporaryFile tempFile(sTempPath + QLatin1String("/XXXXXXXX.txt"));
tempFile.open();
QString sTempFileName = tempFile.fileName();
tempFile.close();
bool bRenamedStatic = QFile::rename(sTempFileName, sTempPath + "/renamed_STATIC.txt");
The return value (bRenamedStatic) with Qt 4.5.3 is always false. With Qt 4.4.2 this piece of code worked. It seems that the tempFile object is still holding a handle to file despite it has been closed, inhibiting the rename operation (due to a sharing violation error).