Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp	(revision 90085)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp	(revision 90086)
@@ -2626,4 +2626,78 @@
 }
 
+bool UICommon::restoreCurrentSnapshot(const QUuid &uMachineId)
+{
+    /* Prepare result: */
+    bool fResult = false;
+
+    /* Open a session to modify VM: */
+    const bool fDirectSessionAvailable = (m_enmType == UIType_RuntimeUI) && isSeparateProcess();
+    CSession comSession = openSession(uMachineId, fDirectSessionAvailable ? KLockType_Write : KLockType_Shared);
+    if (!comSession.isNull())
+    {
+        /* Simulate try-catch block: */
+        do
+        {
+            /* Acquire session machine: */
+            CMachine comMachine = comSession.GetMachine();
+            if (!comSession.isOk())
+            {
+                msgCenter().cannotAcquireSessionParameter(comSession);
+                break;
+            }
+
+            /* Acquire machine name: */
+            const QString strMachineName = comMachine.GetName();
+            if (!comMachine.isOk())
+            {
+                msgCenter().cannotAcquireMachineParameter(comMachine);
+                break;
+            }
+
+            /* Acquire current snapshot: */
+            const CSnapshot comSnapshot = comMachine.GetCurrentSnapshot();
+            if (!comMachine.isOk())
+            {
+                msgCenter().cannotAcquireMachineParameter(comMachine);
+                break;
+            }
+
+            /* Acquire snapshot name: */
+            const QString strSnapshotName = comSnapshot.GetName();
+            if (!comSnapshot.isOk())
+            {
+                msgCenter().cannotAcquireSnapshotParameter(comSnapshot);
+                break;
+            }
+
+            /* Prepare the snapshot-discard progress: */
+            CProgress comProgress = comMachine.RestoreSnapshot(comSnapshot);
+            if (!comMachine.isOk())
+            {
+                msgCenter().cannotRestoreSnapshot(comMachine, strSnapshotName, strMachineName);
+                break;
+            }
+
+            /* Show the snapshot-discard progress: */
+            msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_snapshot_discard_90px.png");
+            if (comProgress.GetResultCode() != 0)
+            {
+                msgCenter().cannotRestoreSnapshot(comProgress, strSnapshotName, strMachineName);
+                break;
+            }
+
+            /* Success: */
+            fResult = true;
+        }
+        while (0);
+
+        /* Unlock machine finally: */
+        comSession.UnlockMachine();
+    }
+
+    /* Return result: */
+    return fResult;
+}
+
 void UICommon::notifyCloudMachineUnregistered(const QString &strProviderShortName,
                                               const QString &strProfileName,
Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h	(revision 90085)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h	(revision 90086)
@@ -510,4 +510,7 @@
           * otherwise, no session will be created and machine will be left unchanged. */
         CSession tryToOpenSessionFor(CMachine &comMachine);
+
+        /** Restores current snapshot for machine with certain @a uMachineId. */
+        bool restoreCurrentSnapshot(const QUuid &uMachineId);
     /** @} */
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	(revision 90085)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	(revision 90086)
@@ -620,4 +620,11 @@
 }
 
+void UIMessageCenter::cannotAcquireSessionParameter(const CSession &comSession, QWidget *pParent /* = 0 */) const
+{
+    /* Show the error: */
+    error(pParent, MessageType_Error,
+          tr("Failed to acquire session parameter."), UIErrorString::formatErrorInfo(comSession));
+}
+
 void UIMessageCenter::cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent /* = 0 */) const
 {
@@ -625,4 +632,11 @@
     error(pParent, MessageType_Error,
           tr("Failed to acquire machine parameter."), UIErrorString::formatErrorInfo(comMachine));
+}
+
+void UIMessageCenter::cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot, QWidget *pParent /* = 0 */) const
+{
+    /* Show the error: */
+    error(pParent, MessageType_Error,
+          tr("Failed to acquire snapshot parameter."), UIErrorString::formatErrorInfo(comSnapshot));
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h	(revision 90085)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h	(revision 90086)
@@ -273,5 +273,7 @@
     void warnAboutInvalidEncryptionPassword(const QString &strPasswordId, QWidget *pParent = 0);
     void cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox, QWidget *pParent = 0) const;
+    void cannotAcquireSessionParameter(const CSession &comSession, QWidget *pParent = 0) const;
     void cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent = 0) const;
+    void cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot, QWidget *pParent = 0) const;
     void cannotFindHelpFile(const QString &strFileLocation) const;
     void cannotEnumerateHostUSBDevices(const CHost &comHost, QWidget *pParent = 0) const;
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 90085)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 90086)
@@ -379,5 +379,5 @@
             /* Discard the current state if requested: */
             if (fIncludingDiscard)
-                return restoreCurrentSnapshot();
+                return uiCommon().restoreCurrentSnapshot(uiCommon().managedVMUuid());
         }
         else
@@ -405,77 +405,4 @@
     /* Passed: */
     return true;
-}
-
-bool UISession::restoreCurrentSnapshot()
-{
-    /* Prepare result: */
-    bool fResult = false;
-
-    /* Simulate try-catch block: */
-    do
-    {
-        /* Search for corresponding VM: */
-        CVirtualBox vbox = uiCommon().virtualBox();
-        const QUuid uMachineID = uiCommon().managedVMUuid();
-        const CMachine mach = vbox.FindMachine(uMachineID.toString());
-        if (!vbox.isOk() || mach.isNull())
-        {
-            /* Unable to find VM: */
-            msgCenter().cannotFindMachineById(vbox, uMachineID);
-            break;
-        }
-
-        /* Open a direct session to modify that VM: */
-        CSession sess = uiCommon().openSession(uiCommon().managedVMUuid(),
-                                                 uiCommon().isSeparateProcess()
-                                                 ? KLockType_Write : KLockType_Shared);
-        if (sess.isNull())
-        {
-            /* Unable to open session: */
-            break;
-        }
-
-        /* Simulate try-catch block: */
-        do
-        {
-            /* Acquire machine for this session: */
-            CMachine machine = sess.GetMachine();
-            if (machine.isNull())
-            {
-                /* Unable to acquire machine: */
-                break;
-            }
-
-            /* Prepare the snapshot-discard progress: */
-            const CSnapshot snap = machine.GetCurrentSnapshot();
-            CProgress prog = machine.RestoreSnapshot(snap);
-            if (!machine.isOk() || prog.isNull())
-            {
-                /* Unable to restore snapshot: */
-                msgCenter().cannotRestoreSnapshot(machine, snap.GetName(), machineName());
-                break;
-            }
-
-            /* Show the snapshot-discard progress: */
-            msgCenter().showModalProgressDialog(prog, machine.GetName(), ":/progress_snapshot_discard_90px.png");
-            if (prog.GetResultCode() != 0)
-            {
-                /* Unable to restore snapshot: */
-                msgCenter().cannotRestoreSnapshot(prog, snap.GetName(), machine.GetName());
-                break;
-            }
-
-            /* Success: */
-            fResult = true;
-        }
-        while (0);
-
-        /* Unlock machine finally: */
-        sess.UnlockMachine();
-    }
-    while (0);
-
-    /* Return result: */
-    return fResult;
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h	(revision 90085)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h	(revision 90086)
@@ -80,5 +80,4 @@
     bool shutdown();
     bool powerOff(bool fIncludingDiscard, bool &fServerCrashed);
-    bool restoreCurrentSnapshot();
 
     /** Returns the session instance. */
