Index: /trunk/src/VBox/Devices/Storage/DrvHostBase-win.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvHostBase-win.cpp	(revision 66074)
+++ /trunk/src/VBox/Devices/Storage/DrvHostBase-win.cpp	(revision 66075)
@@ -539,13 +539,4 @@
 
 
-DECLHIDDEN(int) drvHostBasePollerWakeupOs(PDRVHOSTBASE pThis)
-{
-    if (pThis->Os.hwndDeviceChange)
-        PostMessage(pThis->Os.hwndDeviceChange, WM_CLOSE, 0, 0); /* default win proc will destroy the window */
-
-    return VINF_SUCCESS;
-}
-
-
 DECLHIDDEN(int) drvHostBaseQueryMediaStatusOs(PDRVHOSTBASE pThis, bool *pfMediaChanged, bool *pfMediaPresent)
 {
@@ -565,4 +556,23 @@
 DECLHIDDEN(void) drvHostBaseDestructOs(PDRVHOSTBASE pThis)
 {
+    /*
+     * Terminate the thread.
+     */
+    if (pThis->Os.hThrdMediaChange != NIL_RTTHREAD)
+    {
+        int rc;
+        int cTimes = 50;
+        do
+        {
+            if (pThis->hwndDeviceChange)
+                PostMessage(pThis->hwndDeviceChange, WM_CLOSE, 0, 0); /* default win proc will destroy the window */
+
+            rc = RTThreadWait(pThis->Os.hThrdMediaChange, 100, NULL);
+        } while (cTimes-- > 0 && rc == VERR_TIMEOUT);
+
+        if (RT_SUCCESS(rc))
+            pThis->Os.hThrdMediaChange = NIL_RTTHREAD;
+    }
+
     /*
      * Unlock the drive if we've locked it or we're in passthru mode.
