Index: /trunk/src/VBox/Main/glue/EventQueue.cpp
===================================================================
--- /trunk/src/VBox/Main/glue/EventQueue.cpp	(revision 46716)
+++ /trunk/src/VBox/Main/glue/EventQueue.cpp	(revision 46717)
@@ -91,5 +91,5 @@
     {
         fWait = mEvents.size() == 0;
-        if (!fWait)
+        if (fWait)
         {
             int rc2 = RTCritSectLeave(&mCritSect);
@@ -98,12 +98,15 @@
     }
     else
-        fWait = false;
-
-    if (fWait)
     {
         int rc2 = RTCritSectLeave(&mCritSect);
         AssertRC(rc2);
-
+        fWait = false;
+    }
+
+    if (fWait)
+    {
         rc = RTSemEventWaitNoResume(mSemEvent, cMsTimeout);
+        if (RT_SUCCESS(rc))
+            rc = RTCritSectEnter(&mCritSect);
     }
 
@@ -113,6 +116,4 @@
             return VERR_INTERRUPTED;
 
-        if (fWait)
-            rc = RTCritSectEnter(&mCritSect);
         if (RT_SUCCESS(rc))
         {
