Index: /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 35480)
+++ /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 35481)
@@ -241,28 +241,21 @@
 {
     VMPowerDownTask(Console *aConsole,
-                    const ComPtr<IProgress> &aServerProgress,
-                    MachineState_T aLastMachineState)
+                    const ComPtr<IProgress> &aServerProgress)
+        : VMTask(aConsole, NULL /* aProgress */, aServerProgress,
+                 true /* aUsesVMPtr */)
+    {}
+};
+
+struct VMSaveTask : public VMTask
+{
+    VMSaveTask(Console *aConsole,
+               const ComPtr<IProgress> &aServerProgress,
+               const Utf8Str &aSavedStateFile)
         : VMTask(aConsole, NULL /* aProgress */, aServerProgress,
                  true /* aUsesVMPtr */),
-          mLastMachineState(aLastMachineState)
+          mSavedStateFile(aSavedStateFile)
     {}
 
-    MachineState_T mLastMachineState;
-};
-
-struct VMSaveTask : public VMTask
-{
-    VMSaveTask(Console *aConsole,
-               const ComPtr<IProgress> &aServerProgress,
-               const Utf8Str &aSavedStateFile,
-               MachineState_T aLastMachineState)
-        : VMTask(aConsole, NULL /* aProgress */, aServerProgress,
-                 true /* aUsesVMPtr */),
-          mSavedStateFile(aSavedStateFile),
-          mLastMachineState(aLastMachineState)
-    {}
-
     Utf8Str mSavedStateFile;
-    MachineState_T mLastMachineState;
 };
 
@@ -1821,6 +1814,5 @@
 
         /* setup task object and thread to carry out the operation asynchronously */
-        std::auto_ptr<VMPowerDownTask> task(new VMPowerDownTask(this, pProgress,
-                                                                lastMachineState));
+        std::auto_ptr<VMPowerDownTask> task(new VMPowerDownTask(this, pProgress));
         AssertBreakStmt(task->isOk(), rc = E_FAIL);
 
@@ -2468,6 +2460,5 @@
         /* create a task object early to ensure mpVM protection is successful */
         std::auto_ptr<VMSaveTask> task(new VMSaveTask(this, pProgress,
-                                                      stateFilePath,
-                                                      lastMachineState));
+                                                      stateFilePath));
         rc = task->rc();
         /*
@@ -6446,6 +6437,15 @@
                 that->mVMPoweredOff = true;
 
-                /* we are stopping now */
-                that->setMachineState(MachineState_Stopping);
+                /*
+                 * request a progress object from the server
+                 * (this will set the machine state to Stopping on the server
+                 * to block others from accessing this machine)
+                 */
+                ComPtr<IProgress> pProgress;
+                HRESULT rc = that->mControl->BeginPoweringDown(pProgress.asOutParam());
+                AssertComRC(rc);
+
+                /* sync the state with the server */
+                that->setMachineStateLocally(MachineState_Stopping);
 
                 /* Setup task object and thread to carry out the operation
@@ -6455,6 +6455,5 @@
                  */
                 std::auto_ptr<VMPowerDownTask> task(new VMPowerDownTask(that,
-                                                                        NULL /* aServerProgress */,
-                                                                        MachineState_Null));
+                                                                        pProgress));
 
                  /* If creating a task failed, this can currently mean one of
