Index: /trunk/src/VBox/Main/include/SessionImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/SessionImpl.h	(revision 56447)
+++ /trunk/src/VBox/Main/include/SessionImpl.h	(revision 56448)
@@ -141,5 +141,5 @@
 
 
-    HRESULT i_unlockMachine(bool aFinalRelease, bool aFromServer);
+    HRESULT i_unlockMachine(bool aFinalRelease, bool aFromServer, AutoWriteLock *pLockW);
 
     SessionState_T mState;
Index: /trunk/src/VBox/Main/src-client/SessionImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/SessionImpl.cpp	(revision 56447)
+++ /trunk/src/VBox/Main/src-client/SessionImpl.cpp	(revision 56448)
@@ -123,5 +123,5 @@
                mState == SessionState_Spawning);
 
-        HRESULT rc = i_unlockMachine(true /* aFinalRelease */, false /* aFromServer */);
+        HRESULT rc = i_unlockMachine(true /* aFinalRelease */, false /* aFromServer */, &alock);
         AssertComRC(rc);
     }
@@ -240,6 +240,5 @@
 
     CHECK_OPEN();
-
-    return i_unlockMachine(false /* aFinalRelease */, false /* aFromServer */);
+    return i_unlockMachine(false /* aFinalRelease */, false /* aFromServer */, &alock);
 }
 
@@ -535,5 +534,5 @@
 
         /* close ourselves */
-        rc = i_unlockMachine(false /* aFinalRelease */, true /* aFromServer */);
+        rc = i_unlockMachine(false /* aFinalRelease */, true /* aFromServer */, &alock);
     }
     else if (getObjectState().getState() == ObjectState::InUninit)
@@ -1058,9 +1057,11 @@
  *  @param aFinalRelease    called as a result of FinalRelease()
  *  @param aFromServer      called as a result of Uninitialize()
+ *  @param pLockW           The write lock this object is protected with.
+ *                          Must be acquired already and will be released
+ *                          and later reacquired during the unlocking.
  *
  *  @note To be called only from #uninit(), #UnlockMachine() or #Uninitialize().
- *  @note Locks this object for writing.
  */
-HRESULT Session::i_unlockMachine(bool aFinalRelease, bool aFromServer)
+HRESULT Session::i_unlockMachine(bool aFinalRelease, bool aFromServer, AutoWriteLock *pLockW)
 {
     LogFlowThisFuncEnter();
@@ -1068,7 +1069,7 @@
                       aFinalRelease, aFromServer));
 
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     LogFlowThisFunc(("mState=%s, mType=%d\n", Global::stringifySessionState(mState), mType));
+
+    Assert(pLockW->isWriteLockOnCurrentThread());
 
     if (mState != SessionState_Locked)
@@ -1137,5 +1138,5 @@
          *  SessionState_Closing here, so it's safe.
          */
-        alock.release();
+        pLockW->release();
 
         LogFlowThisFunc(("Calling mControl->OnSessionEnd()...\n"));
@@ -1143,5 +1144,5 @@
         LogFlowThisFunc(("mControl->OnSessionEnd()=%08X\n", rc));
 
-        alock.acquire();
+        pLockW->acquire();
 
         /*
