Index: /trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
===================================================================
--- /trunk/src/VBox/Frontends/VBoxShell/vboxshell.py	(revision 31033)
+++ /trunk/src/VBox/Frontends/VBoxShell/vboxshell.py	(revision 31034)
@@ -491,5 +491,5 @@
         vb = ctx['vb']
         session = ctx['mgr'].getSessionObject(vb)
-        mach.lockForSession(session, True)
+        mach.lockMachine(session, ctx['global'].constants.LockType_Shared)
     except Exception,e:
         printErr(ctx, "Session to '%s' not open: %s" %(mach.name,str(e)))
Index: /trunk/src/VBox/Main/EventImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/EventImpl.cpp	(revision 31033)
+++ /trunk/src/VBox/Main/EventImpl.cpp	(revision 31034)
@@ -812,7 +812,9 @@
     ::RTCritSectEnter(&mcsQLock);
 
-    // If there was no events reading from the listener for the long time, 
-    // and events keep coming we shall unregister it.
-    if ((mQueue.size() > 200) && ((RTTimeMilliTS() - mLastRead) > 60 * 1000))
+    // If there was no events reading from the listener for the long time,
+    // and events keep coming, or queue is oversized we shall unregister this listener.
+    uint64_t sinceRead = RTTimeMilliTS() - mLastRead;
+    uint32_t queueSize = mQueue.size();
+    if ( (queueSize > 200) || ((queueSize > 100) && (sinceRead > 60 * 1000)))
     {
         ::RTCritSectLeave(&mcsQLock);
Index: /trunk/src/VBox/Main/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 31033)
+++ /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 31034)
@@ -315,8 +315,4 @@
     const RTTHREAD                      threadAsyncEvent;
     EventQueue * const                  pAsyncEventQ;
-
-#ifdef RT_OS_WINDOWS
-    ComEventsHelper                     mComEvHelper;
-#endif
     const ComObjPtr<EventSource>        pEventSource;
 };
Index: /trunk/src/VBox/Main/glue/vboxapi.py
===================================================================
--- /trunk/src/VBox/Main/glue/vboxapi.py	(revision 31033)
+++ /trunk/src/VBox/Main/glue/vboxapi.py	(revision 31034)
@@ -521,5 +521,9 @@
     def openMachineSession(self, mach, permitSharing = True):
          session = self.mgr.getSessionObject(self.vbox)
-         mach.lockForSession(session, permitSharing)
+         if permitSharing:
+             type = self.constants.LockType_Shared
+         else:
+             type = self.constants.LockType_Write
+         mach.lockMachine(session, type)
          return session
 
