diff -r dc268b18d709 -r 6a75fa55495f userlibandfileserver/fileserver/sfile/sf_file.cpp --- a/userlibandfileserver/fileserver/sfile/sf_file.cpp Wed Sep 22 10:53:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_file.cpp Mon Sep 27 10:52:00 2010 +0100 @@ -2772,6 +2772,24 @@ iFile->Close(); } +void CFileShare::Close() + { + + // Flush the write cache before closing the file share + // NB If there is any dirty data, then a new request will be allocated which will increase + // the reference count on this file share, thus preventing it from being deleted untill all + // data has been flushed + if (AccessCount() == 1) + { + CFileCache* fileCache = File().FileCache(); + if (fileCache) + fileCache->FlushDirty(); + } + + CFsDispatchObject::Close(); + } + + /** Check that the media is still mounted.