diff -u tcl8.5.12/win/tclWinSock.c\~ tcl8.5.12/win/tclWinSock.c
--- tcl8.5.12/win/tclWinSock.c~	2012-07-16 13:57:06.000000000 +0200
+++ tcl8.5.12/win/tclWinSock.c	2012-11-05 19:30:59.000000000 +0100
@@ -461,7 +461,7 @@
     if (tsdPtr != NULL) {
 	if (tsdPtr->socketThread != NULL) {
 	    if (tsdPtr->hwnd != NULL) {
-		PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0);
+		if (PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0)) {
 
 		/*
 		 * Wait for the thread to exit. This ensures that we are
@@ -469,6 +469,7 @@
 		 */
 
 		WaitForSingleObject(tsdPtr->readyEvent, INFINITE);
+		}
 		tsdPtr->hwnd = NULL;
 	    }
 	    CloseHandle(tsdPtr->socketThread);

Diff finished.  Mon Nov  5 19:31:03 2012
