userlibandfileserver/fileserver/sfile/sf_file.cpp
changeset 273 6a75fa55495f
parent 244 a77889bee936
child 286 48e57fb1237e
--- 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.