Skip to content

Commit

Permalink
Disable memory mapped IO before entering write lock
Browse files Browse the repository at this point in the history
  • Loading branch information
ElektroKill committed Dec 9, 2023
1 parent 83ff9ce commit 1cdfdaa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dnSpy/dnSpy/Documents/DsDocumentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,12 @@ IDsDocument GetOrAddTempCachedDocument(IDsDocument document) {
return existing;
}

// Disable mmap'd I/O before adding it to the temp cache to prevent another thread from
// getting the same file while we're disabling mmap'd I/O. Could lead to crashes.
DisableMMapdIO(document);

tempCacheLock.EnterWriteLock();
try {
// Disable mmap'd I/O before adding it to the temp cache to prevent another thread from
// getting the same file while we're disabling mmap'd I/O. Could lead to crashes.
DisableMMapdIO(document);
if (!AssemblyLoadEnabled)
tempCache.Add(document);
}
Expand Down

0 comments on commit 1cdfdaa

Please sign in to comment.