Index: /trunk/src/VBox/Main/webservice/vboxweb.cpp
===================================================================
--- /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 60512)
+++ /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 60513)
@@ -6,5 +6,5 @@
  *      server, to which clients can connect.
  *
- * Copyright (C) 2007-2015 Oracle Corporation
+ * Copyright (C) 2007-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -964,5 +964,5 @@
 #ifdef RT_OS_WINDOWS
 // Required for ATL
-static CComModule _Module;
+static ATL::CComModule _Module;
 
 /**
@@ -981,7 +981,11 @@
         case CTRL_LOGOFF_EVENT:
         case CTRL_SHUTDOWN_EVENT:
+        {
             ASMAtomicWriteBool(&g_fKeepRunning, false);
+            com::NativeEventQueue *pQ = com::NativeEventQueue::getMainEventQueue();
+            pQ->interruptEventQueueProcessing();
             fEventHandled = TRUE;
             break;
+        }
         default:
             break;
@@ -990,16 +994,4 @@
 }
 #else
-class ForceQuitEvent : public com::NativeEvent
-{
-    void *handler()
-    {
-        LogFlowFunc(("\n"));
-
-        ASMAtomicWriteBool(&g_fKeepRunning, false);
-
-        return NULL;
-    }
-};
-
 /**
  * Signal handler for cleanly terminating the event loop.
@@ -1008,6 +1000,7 @@
 {
     NOREF(iSignal);
+    ASMAtomicWriteBool(&g_fKeepRunning, false);
     com::NativeEventQueue *pQ = com::NativeEventQueue::getMainEventQueue();
-    pQ->postEvent(new ForceQuitEvent());
+    pQ->interruptEventQueueProcessing();
 }
 #endif
