]> git.lyx.org Git - features.git/commit
Add class for threadsafe temp file handling
authorGeorg Baum <baum@lyx.org>
Sun, 14 Apr 2013 16:17:56 +0000 (18:17 +0200)
committerGeorg Baum <baum@lyx.org>
Sun, 14 Apr 2013 16:22:42 +0000 (18:22 +0200)
commitdb0ba3a3c68d2243722822e1c53535ff44d523bf
tree5c0ad534a273b6fbf179adcf0417f06e08a29518
parentf6ca8350cde26c90391e29fad16437f7b3287092
Add class for threadsafe temp file handling

FileName::tempName() is not thread safe, since the QTemporaryFile object is
immediately deleted after creating it. Therefore, another thread could create
the same temporary file in the time span before the user of FileName::tempName()
recreates it. This is not as theoretical as it may look: I observed that
repeated creation and deletion of QTemporaryFile objects always use the same
name.
This problem is solved by the new class TempFile which should be used like
QTemporaryFile itself.
src/support/FileName.cpp
src/support/FileName.h
src/support/Makefile.am
src/support/TempFile.cpp [new file with mode: 0644]
src/support/TempFile.h [new file with mode: 0644]