-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
5.15.12
-
None
-
Windows 10
Linux Yocto Kirkstone running on iMX.6
https://doc.qt.io/qt-5/qtemporarydir.html#details says that as soon as the scope where the QTemporaryDir was created is left, the directory gets removed if autoRemove is set to true.
However, it seems that directories are not automatically removed upon destruction of the object.
- Created directory is valid and created
- AutoRemove flag is set to true (checked via your class' method)
- Tested with empty directories and ones that have a file in them
- Directories also not destructed after clean shutdown/reboot of the application (and also of the system itself)
- Tested with absolute paths and default temp ones
- manual call to remove, removes the directory successfully
Pseudo code-snippet:
const auto dir= new QTemporaryDir("/my/path"); if(dir->isValid()) { if(!dir->remove()) { const auto negIndicator= new QTemporaryDir("/my/path/failed"); } else{ const auto posIndicator = new QTemporaryDir("/my/path/success"); if(posIndicator->isValid()) { QString path = posIndicator->path(); QFile file(path + "/myFile.txt"); if(file.open(QFile::WriteOnly | QFile::Truncate)) { QTextStream stream(&file); stream << "something" << (dir->autoRemove() ? " true" : " false") << (posIndicator->autoRemove() ? " true" : " false") << "/n"; } } }