Skip to content

Commit bba30c6

Browse files
committed
Fix infinite loop on new files copied during refreshing.
1 parent 4f72f40 commit bba30c6

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/sw/builder/file.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ FileData &FileData::operator=(const FileData &rhs)
5252
//flags = rhs.flags;
5353

5454
refreshed = rhs.refreshed.load();
55-
//if (refreshed == FileData::RefreshType::InProcess)
56-
//refreshed = FileData::RefreshType::Unrefreshed;
55+
56+
// if we copy data during refresh() we get bad state
57+
// FIXME: later we must delete file data
58+
if (refreshed == FileData::RefreshType::InProcess)
59+
refreshed = FileData::RefreshType::Unrefreshed;
5760

5861
return *this;
5962
}
@@ -93,14 +96,6 @@ void FileData::refresh(const path &file)
9396
if (!refreshed.compare_exchange_strong(r, FileData::RefreshType::InProcess))
9497
return;
9598

96-
// extra protection
97-
// some files throw before the last line :(
98-
/*SCOPE_EXIT
99-
{
100-
if (refreshed == FileData::RefreshType::InProcess)
101-
refreshed = FileData::RefreshType::Unrefreshed;
102-
};*/
103-
10499
bool changed = false;
105100
auto s = fs::status(file);
106101
if (s.type() != fs::file_type::regular)

0 commit comments

Comments
 (0)