Index: /trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp
===================================================================
--- /trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp	(revision 26180)
+++ /trunk/src/VBox/VMM/PDMAsyncCompletionFileCache.cpp	(revision 26181)
@@ -275,5 +275,5 @@
 
         /* We can't evict pages which are currently in progress */
-        if (!(pCurr->fFlags & PDMACFILECACHE_ENTRY_IO_IN_PROGRESS)
+        if (   !(pCurr->fFlags & PDMACFILECACHE_ENTRY_IO_IN_PROGRESS)
             && (ASMAtomicReadU32(&pCurr->cRefs) == 0))
         {
@@ -951,9 +951,9 @@
 
     /* Make sure nobody is accessing the cache while we delete the tree. */
+    RTCritSectEnter(&pCache->CritSect);
     RTSemRWRequestWrite(pEndpointCache->SemRWEntries, RT_INDEFINITE_WAIT);
-    RTCritSectEnter(&pCache->CritSect);
     RTAvlrFileOffsetDestroy(pEndpointCache->pTree, pdmacFileEpCacheEntryDestroy, pCache);
+    RTSemRWReleaseWrite(pEndpointCache->SemRWEntries);
     RTCritSectLeave(&pCache->CritSect);
-    RTSemRWReleaseWrite(pEndpointCache->SemRWEntries);
 
     RTSemRWDestroy(pEndpointCache->SemRWEntries);
