Commit fbe7067b authored by Igor Kushnir's avatar Igor Kushnir Committed by Milian Wolff
Browse files

Don't create a file in a directory before removing it recursively

bc828ea9 removed no longer necessary
KLockFile::Ptr m_lock from ItemRepositoryRegistry, but failed to remove
the lockForWriting() call, which worked around an issue related to
m_lock. From the documentation to QDir::removeRecursively():
  If a file or directory cannot be removed, removeRecursively() keeps
  going and attempts to delete as many files and sub-directories as
  possible, then returns false.

Clearly, any protection offered by creating the "is_writing" file in the
directory is unreliable because removeRecursively() may remove the newly
created file first.
parent a1b364ab
......@@ -250,10 +250,6 @@ void ItemRepositoryRegistryPrivate::deleteDataDirectory(bool recreate)
{
QMutexLocker lock(&m_mutex);
//lockForWriting creates a file, that prevents any other KDevelop instance from using the directory as it is.
//Instead, the other instance will try to delete the directory as well.
lockForWriting();
bool result = QDir(m_path).removeRecursively();
Q_ASSERT(result);
Q_UNUSED(result);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment