Index: /trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp	(revision 81133)
+++ /trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp	(revision 81134)
@@ -246,4 +246,7 @@
         {
             LogFunc(("WM_CLIPBOARDUPDATE: pWinCtx=%p\n", pWinCtx));
+
+            if (pCtx->fShutdown) /* If we're about to shut down, skip handling stuff here. */
+                break;
 
             int rc = RTCritSectEnter(&pWinCtx->CritSect);
@@ -828,13 +831,5 @@
     LogRel2(("Shared Clipboard: Destroying ...\n"));
 
-    pCtx->fShutdown = true;
-
     const PSHCLWINCTX pWinCtx = &pCtx->Win;
-
-    if (pWinCtx->hWnd)
-    {
-        DestroyWindow(pWinCtx->hWnd);
-        pWinCtx->hWnd = NULL;
-    }
 
     if (pCtx->hThread != NIL_RTTHREAD)
@@ -845,4 +840,10 @@
                      rc, rcThread));
         RT_NOREF(rc);
+    }
+
+    if (pWinCtx->hWnd)
+    {
+        DestroyWindow(pWinCtx->hWnd);
+        pWinCtx->hWnd = NULL;
     }
 
@@ -1019,4 +1020,10 @@
                     }
 
+                    case VBOX_SHCL_HOST_MSG_QUIT:
+                    {
+                        pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_QUIT;
+                        break;
+                    }
+
                     default:
                         rc = VERR_NOT_SUPPORTED;
@@ -1145,4 +1152,12 @@
     AssertPtr(pCtx);
 
+    /* Set shutdown indicator. */
+    ASMAtomicWriteBool(&pCtx->fShutdown, true);
+
+    /* Let our clipboard know that we're going to shut down. */
+    PostMessage(pCtx->Win.hWnd, WM_QUIT, 0, 0);
+
+    /* Disconnect from the host service.
+    /* This will also send a VBOX_SHCL_HOST_MSG_QUIT from the host so that we can break out from our message worker. */
     VbglR3ClipboardDisconnect(pCtx->CmdCtx.uClientID);
     pCtx->CmdCtx.uClientID = 0;
