Author: alanmc
Date: 2007-03-31 13:18:15 -0500 (Sat, 31 Mar 2007)
New Revision: 75247

Modified:
   trunk/bitsharp/src/MonoTorrent.Client/Managers/FileManager.cs
Log:
Re-ordered events to avoid disposing a filestream while being in the middle of 
writing some data.

Modified: trunk/bitsharp/src/MonoTorrent.Client/Managers/FileManager.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent.Client/Managers/FileManager.cs       
2007-03-31 18:05:35 UTC (rev 75246)
+++ trunk/bitsharp/src/MonoTorrent.Client/Managers/FileManager.cs       
2007-03-31 18:18:15 UTC (rev 75247)
@@ -176,17 +176,17 @@
         /// </summary>
         internal void CloseFileStreams()
         {
-            for (int i = 0; i < this.fileStreams.Length; i++)
-                this.fileStreams[i].Dispose();
-
-            this.fileStreams = null;
-
             // Setting this boolean true allows the IO thread to terminate 
gracefully
             this.ioActive = false;
 
             // Allow the IO thread to run.
             SetHandleState(true);
                        this.ioThread.Join(150);
+
+            for (int i = 0; i < this.fileStreams.Length; i++)
+                this.fileStreams[i].Dispose();
+
+            this.fileStreams = null;
         }
 
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to