Index: win/tclWinSerial.c
===================================================================
RCS file: /cvs/kit/tcl/win/tclWinSerial.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -b -w -r1.1 -r1.2
--- win/tclWinSerial.c	2005/01/27 22:53:38	1.1
+++ win/tclWinSerial.c	2005/09/20 13:32:47	1.2
@@ -653,7 +653,6 @@
 
         CloseHandle(serialPtr->writeThread);
 	CloseHandle(serialPtr->osWrite.hEvent);
-	DeleteCriticalSection(&serialPtr->csWrite);
         CloseHandle(serialPtr->evWritable);
         CloseHandle(serialPtr->evStartWriter);
         CloseHandle(serialPtr->evStopWriter);
@@ -661,6 +660,7 @@
 
         PurgeComm(serialPtr->handle, PURGE_TXABORT | PURGE_TXCLEAR);
     }
+    DeleteCriticalSection(&serialPtr->csWrite);
     serialPtr->validMask &= ~TCL_WRITABLE;
 
     /*
@@ -1471,6 +1471,7 @@
     if (permissions & TCL_READABLE) {
         infoPtr->osRead.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
     }
+    InitializeCriticalSection(&infoPtr->csWrite);
     if (permissions & TCL_WRITABLE) {
         /* 
         * Initially the channel is writable
@@ -1480,7 +1481,6 @@
         infoPtr->evWritable = CreateEvent(NULL, TRUE, TRUE, NULL);
         infoPtr->evStartWriter = CreateEvent(NULL, FALSE, FALSE, NULL);
 	infoPtr->evStopWriter = CreateEvent(NULL, FALSE, FALSE, NULL);
-        InitializeCriticalSection(&infoPtr->csWrite);
         infoPtr->writeThread = CreateThread(NULL, 256, SerialWriterThread,
             infoPtr, 0, &id);
     }
