Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 53029)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 53030)
@@ -251,4 +251,44 @@
 }
 
+CMachine& UIMachineLogic::machine() const
+{
+    return uisession()->machine();
+}
+
+CConsole& UIMachineLogic::console() const
+{
+    return uisession()->console();
+}
+
+CDisplay& UIMachineLogic::display() const
+{
+    return uisession()->display();
+}
+
+CGuest& UIMachineLogic::guest() const
+{
+    return uisession()->guest();
+}
+
+CMouse& UIMachineLogic::mouse() const
+{
+    return uisession()->mouse();
+}
+
+CKeyboard& UIMachineLogic::keyboard() const
+{
+    return uisession()->keyboard();
+}
+
+CMachineDebugger& UIMachineLogic::debugger() const
+{
+    return uisession()->debugger();
+}
+
+const QString& UIMachineLogic::machineName() const
+{
+    return uisession()->machineName();
+}
+
 UIMachineWindow* UIMachineLogic::mainMachineWindow() const
 {
@@ -348,6 +388,5 @@
 {
     /* Warn the user about ACPI is not available if so: */
-    CConsole console = session().GetConsole();
-    if (!console.GetGuestEnteredACPIMode())
+    if (!console().GetGuestEnteredACPIMode())
         return popupCenter().cannotSendACPIToMachine(activeMachineWindow());
 
@@ -431,5 +470,5 @@
             uisession()->setGuestResizeIgnored(true);
             /* Get log-folder: */
-            QString strLogFolder = session().GetMachine().GetLogFolder();
+            QString strLogFolder = machine().GetLogFolder();
             /* Take the screenshot for debugging purposes: */
             takeScreenshot(strLogFolder + "/VBox.png", "png");
@@ -581,7 +620,7 @@
     {
         if (fIsAttached)
-            msgCenter().cannotAttachUSBDevice(error, vboxGlobal().details(device), session().GetMachine().GetName());
+            msgCenter().cannotAttachUSBDevice(error, vboxGlobal().details(device), machineName());
         else
-            msgCenter().cannotDetachUSBDevice(error, vboxGlobal().details(device), session().GetMachine().GetName());
+            msgCenter().cannotDetachUSBDevice(error, vboxGlobal().details(device), machineName());
     }
 }
@@ -589,5 +628,5 @@
 void UIMachineLogic::sltRuntimeError(bool fIsFatal, const QString &strErrorId, const QString &strMessage)
 {
-    msgCenter().showRuntimeError(session().GetConsole(), fIsFatal, strErrorId, strMessage);
+    msgCenter().showRuntimeError(console(), fIsFatal, strErrorId, strMessage);
 }
 
@@ -1052,5 +1091,5 @@
 
     /* Monitor selection if there are more than one monitor */
-    int cGuestScreens = uisession()->session().GetMachine().GetMonitorCount();
+    int cGuestScreens = machine().GetMonitorCount();
     if (cGuestScreens > 1)
     {
@@ -1078,5 +1117,5 @@
 
     /* Now the dock icon preview */
-    QString osTypeId = session().GetConsole().GetGuest().GetOSTypeId();
+    QString osTypeId = guest().GetOSTypeId();
     m_pDockIconPreview = new UIDockIconPreview(uisession(), vboxGlobal().vmGuestOSTypeIcon(osTypeId));
 
@@ -1266,8 +1305,6 @@
 void UIMachineLogic::sltTypeCAD()
 {
-    CKeyboard keyboard = session().GetConsole().GetKeyboard();
-    Assert(!keyboard.isNull());
-    keyboard.PutCAD();
-    AssertWrapperOk(keyboard);
+    keyboard().PutCAD();
+    AssertWrapperOk(keyboard());
 }
 
@@ -1275,15 +1312,13 @@
 void UIMachineLogic::sltTypeCABS()
 {
-    CKeyboard keyboard = session().GetConsole().GetKeyboard();
-    Assert(!keyboard.isNull());
-    static QVector<LONG> aSequence(6);
-    aSequence[0] = 0x1d; /* Ctrl down */
-    aSequence[1] = 0x38; /* Alt down */
-    aSequence[2] = 0x0E; /* Backspace down */
-    aSequence[3] = 0x8E; /* Backspace up */
-    aSequence[4] = 0xb8; /* Alt up */
-    aSequence[5] = 0x9d; /* Ctrl up */
-    keyboard.PutScancodes(aSequence);
-    AssertWrapperOk(keyboard);
+    static QVector<LONG> sequence(6);
+    sequence[0] = 0x1d; /* Ctrl down */
+    sequence[1] = 0x38; /* Alt down */
+    sequence[2] = 0x0E; /* Backspace down */
+    sequence[3] = 0x8E; /* Backspace up */
+    sequence[4] = 0xb8; /* Alt up */
+    sequence[5] = 0x9d; /* Ctrl up */
+    keyboard().PutScancodes(sequence);
+    AssertWrapperOk(keyboard());
 }
 #endif /* Q_WS_X11 */
@@ -1305,19 +1340,16 @@
     }
 
-    /* Get current machine: */
-    CMachine machine = session().GetMachine();
-
     /* Create take-snapshot dialog: */
     QWidget *pDlgParent = windowManager().realParentWindow(activeMachineWindow());
-    QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, machine);
+    QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, machine());
     windowManager().registerNewParent(pDlg, pDlgParent);
 
     /* Assign corresponding icon: */
-    QString strTypeId = machine.GetOSTypeId();
+    QString strTypeId = machine().GetOSTypeId();
     pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(strTypeId));
 
     /* Search for the max available filter index: */
     QString strNameTemplate = QApplication::translate("UIMachineLogic", "Snapshot %1");
-    int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine, machine.FindSnapshot(QString()), strNameTemplate);
+    int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine(), machine().FindSnapshot(QString()), strNameTemplate);
     pDlg->mLeName->setText(strNameTemplate.arg(++ iMaxSnapshotIndex));
 
@@ -1340,15 +1372,14 @@
     {
         /* Prepare the take-snapshot progress: */
-        CConsole console = session().GetConsole();
-        CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription);
-        if (console.isOk())
+        CProgress progress = console().TakeSnapshot(strSnapshotName, strSnapshotDescription);
+        if (console().isOk())
         {
             /* Show the take-snapshot progress: */
-            msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_create_90px.png");
+            msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_snapshot_create_90px.png");
             if (!progress.isOk() || progress.GetResultCode() != 0)
-                msgCenter().cannotTakeSnapshot(progress, machine.GetName());
+                msgCenter().cannotTakeSnapshot(progress, machineName());
         }
         else
-            msgCenter().cannotTakeSnapshot(console, machine.GetName());
+            msgCenter().cannotTakeSnapshot(console(), machineName());
     }
 
@@ -1405,6 +1436,5 @@
 
     /* Request the filename from the user. */
-    const CMachine &machine = session().GetMachine();
-    QFileInfo fi(machine.GetSettingsFilePath());
+    QFileInfo fi(machine().GetSettingsFilePath());
     QString strAbsolutePath(fi.absolutePath());
     QString strCompleteBaseName(fi.completeBaseName());
@@ -1446,11 +1476,10 @@
 {
     /* Confirm/Reset current console: */
-    CMachine machine = session().GetMachine();
-    if (msgCenter().confirmResetMachine(machine.GetName()))
-        session().GetConsole().Reset();
+    if (msgCenter().confirmResetMachine(machineName()))
+        console().Reset();
 
     /* TODO_NEW_CORE: On reset the additional screens didn't get a display
        update. Emulate this for now until it get fixed. */
-    ulong uMonitorCount = machine.GetMonitorCount();
+    ulong uMonitorCount = machine().GetMonitorCount();
     for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId)
         machineWindows().at(uScreenId)->update();
@@ -1495,5 +1524,5 @@
     }
 
-    powerOff(session().GetMachine().GetSnapshotCount() > 0);
+    powerOff(machine().GetSnapshotCount() > 0);
 }
 
@@ -1538,5 +1567,5 @@
      * Its necessary to allow QObject hierarchy cleanup to delete this dialog if necessary: */
     QPointer<UISettingsDialogMachine> pDialog = new UISettingsDialogMachine(activeMachineWindow(),
-                                                                            session().GetMachine().GetId(),
+                                                                            machine().GetId(),
                                                                             strCategory, strControl);
     /* Executing VM settings window.
@@ -1591,11 +1620,9 @@
     AssertMsgReturnVoid(pAction, ("This slot should only be called by menu action!\n"));
 
-    /* Current machine: */
-    const CMachine machine = session().GetMachine();
     /* Current mount-target: */
     const UIMediumTarget target = pAction->data().value<UIMediumTarget>();
 
     /* Update current machine mount-target: */
-    vboxGlobal().updateMachineStorage(machine, target);
+    vboxGlobal().updateMachineStorage(machine(), target);
 }
 
@@ -1609,14 +1636,11 @@
     USBTarget target = pAction->data().value<USBTarget>();
 
-    /* Get current console: */
-    CConsole console = session().GetConsole();
-
     /* Attach USB device: */
     if (target.attach)
     {
         /* Try to attach corresponding device: */
-        console.AttachUSBDevice(target.id);
+        console().AttachUSBDevice(target.id);
         /* Check if console is OK: */
-        if (!console.isOk())
+        if (!console().isOk())
         {
             /* Get current host: */
@@ -1627,5 +1651,5 @@
             CUSBDevice device(hostDevice);
             /* Show a message about procedure failure: */
-            msgCenter().cannotAttachUSBDevice(console, vboxGlobal().details(device));
+            msgCenter().cannotAttachUSBDevice(console(), vboxGlobal().details(device));
         }
     }
@@ -1634,12 +1658,12 @@
     {
         /* Search the console for the corresponding USB device: */
-        CUSBDevice device = console.FindUSBDeviceById(target.id);
+        CUSBDevice device = console().FindUSBDeviceById(target.id);
         /* Try to detach corresponding device: */
-        console.DetachUSBDevice(target.id);
+        console().DetachUSBDevice(target.id);
         /* Check if console is OK: */
-        if (!console.isOk())
+        if (!console().isOk())
         {
             /* Show a message about procedure failure: */
-            msgCenter().cannotDetachUSBDevice(console, vboxGlobal().details(device));
+            msgCenter().cannotDetachUSBDevice(console(), vboxGlobal().details(device));
         }
     }
@@ -1656,6 +1680,5 @@
 
     /* Get current emulated USB: */
-    const CConsole &console = session().GetConsole();
-    CEmulatedUSB dispatcher = console.GetEmulatedUSB();
+    CEmulatedUSB dispatcher = console().GetEmulatedUSB();
 
     /* Attach webcam device: */
@@ -1666,5 +1689,5 @@
         /* Check if dispatcher is OK: */
         if (!dispatcher.isOk())
-            msgCenter().cannotAttachWebCam(dispatcher, target.name, console.GetMachine().GetName());
+            msgCenter().cannotAttachWebCam(dispatcher, target.name, machineName());
     }
     /* Detach webcam device: */
@@ -1675,5 +1698,5 @@
         /* Check if dispatcher is OK: */
         if (!dispatcher.isOk())
-            msgCenter().cannotDetachWebCam(dispatcher, target.name, console.GetMachine().GetName());
+            msgCenter().cannotDetachWebCam(dispatcher, target.name, machineName());
     }
 }
@@ -1683,5 +1706,5 @@
     /* Assign new mode (without save): */
     KClipboardMode mode = pAction->data().value<KClipboardMode>();
-    session().GetMachine().SetClipboardMode(mode);
+    machine().SetClipboardMode(mode);
 }
 
@@ -1693,17 +1716,13 @@
     AssertReturnVoid(pAction);
 
-    /* Get and check current machine: */
-    CMachine machine = session().GetMachine();
-    AssertReturnVoid(!machine.isNull());
-
     /* Get operation target: */
-    CNetworkAdapter adapter = machine.GetNetworkAdapter((ULONG)pAction->property("slot").toInt());
-    AssertReturnVoid(machine.isOk() && !adapter.isNull());
+    CNetworkAdapter adapter = machine().GetNetworkAdapter((ULONG)pAction->property("slot").toInt());
+    AssertReturnVoid(machine().isOk() && !adapter.isNull());
 
     /* Connect/disconnect cable to/from target: */
     adapter.SetCableConnected(!adapter.GetCableConnected());
-    machine.SaveSettings();
-    if (!machine.isOk())
-        msgCenter().cannotSaveMachineSettings(machine);
+    machine().SaveSettings();
+    if (!machine().isOk())
+        msgCenter().cannotSaveMachineSettings(machine());
 }
 
@@ -1712,5 +1731,5 @@
     /* Assign new mode (without save): */
     KDnDMode mode = pAction->data().value<KDnDMode>();
-    session().GetMachine().SetDnDMode(mode);
+    machine().SetDnDMode(mode);
 }
 
@@ -1722,8 +1741,7 @@
 
     /* Access VRDE server: */
-    CMachine machine = session().GetMachine();
-    CVRDEServer server = machine.GetVRDEServer();
+    CVRDEServer server = machine().GetVRDEServer();
     AssertMsg(!server.isNull(), ("VRDE server should NOT be null!\n"));
-    if (!machine.isOk() || server.isNull())
+    if (!machine().isOk() || server.isNull())
         return;
 
@@ -1741,10 +1759,10 @@
         {
             /* Save machine-settings: */
-            machine.SaveSettings();
+            machine().SaveSettings();
             /* Machine still OK? */
-            if (!machine.isOk())
+            if (!machine().isOk())
             {
                 /* Notify about the error: */
-                msgCenter().cannotSaveMachineSettings(machine);
+                msgCenter().cannotSaveMachineSettings(machine());
                 /* Make sure action is updated! */
                 uisession()->updateStatusVRDE();
@@ -1754,5 +1772,5 @@
         {
             /* Notify about the error: */
-            msgCenter().cannotToggleVRDEServer(server, machine.GetName(), fEnabled);
+            msgCenter().cannotToggleVRDEServer(server, machineName(), fEnabled);
             /* Make sure action is updated! */
             uisession()->updateStatusVRDE();
@@ -1767,22 +1785,16 @@
         return;
 
-    /* Access machine: */
-    CMachine machine = session().GetMachine();
-    AssertMsg(!machine.isNull(), ("Machine should NOT be null!\n"));
-    if (machine.isNull())
-        return;
-
     /* Make sure something had changed: */
-    if (machine.GetVideoCaptureEnabled() == static_cast<BOOL>(fEnabled))
+    if (machine().GetVideoCaptureEnabled() == static_cast<BOOL>(fEnabled))
         return;
 
     /* Update Video Capture state: */
-    AssertMsg(machine.isOk(), ("Machine should be OK!\n"));
-    machine.SetVideoCaptureEnabled(fEnabled);
+    AssertMsg(machine().isOk(), ("Machine should be OK!\n"));
+    machine().SetVideoCaptureEnabled(fEnabled);
     /* Machine is not OK? */
-    if (!machine.isOk())
+    if (!machine().isOk())
     {
         /* Notify about the error: */
-        msgCenter().cannotToggleVideoCapture(machine, fEnabled);
+        msgCenter().cannotToggleVideoCapture(machine(), fEnabled);
         /* Make sure action is updated! */
         uisession()->updateStatusVideoCapture();
@@ -1792,10 +1804,10 @@
     {
         /* Save machine-settings: */
-        machine.SaveSettings();
+        machine().SaveSettings();
         /* Machine is not OK? */
-        if (!machine.isOk())
+        if (!machine().isOk())
         {
             /* Notify about the error: */
-            msgCenter().cannotSaveMachineSettings(machine);
+            msgCenter().cannotSaveMachineSettings(machine());
             /* Make sure action is updated! */
             uisession()->updateStatusVideoCapture();
@@ -1878,11 +1890,6 @@
 {
     NOREF(fState);
-    CConsole console = session().GetConsole();
-    if (console.isOk())
-    {
-        CMachineDebugger cdebugger = console.GetDebugger();
-        if (console.isOk())
-            cdebugger.SetLogEnabled(fState);
-    }
+    if (!debugger().isNull() && debugger().isOk())
+        debugger().SetLogEnabled(fState);
 }
 
@@ -1890,5 +1897,5 @@
 {
     /* Show VM Log Viewer: */
-    UIVMLogViewer::showLogViewerFor(activeMachineWindow(), session().GetMachine());
+    UIVMLogViewer::showLogViewerFor(activeMachineWindow(), machine());
 }
 
@@ -1898,21 +1905,13 @@
 void UIMachineLogic::sltDockPreviewModeChanged(QAction *pAction)
 {
-    CMachine machine = session().GetMachine();
-    if (!machine.isNull())
-    {
-        bool fEnabled = pAction != actionPool()->action(UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor);
-        gEDataManager->setRealtimeDockIconUpdateEnabled(fEnabled, vboxGlobal().managedVMUuid());
-        updateDockOverlay();
-    }
+    bool fEnabled = pAction != actionPool()->action(UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor);
+    gEDataManager->setRealtimeDockIconUpdateEnabled(fEnabled, vboxGlobal().managedVMUuid());
+    updateDockOverlay();
 }
 
 void UIMachineLogic::sltDockPreviewMonitorChanged(QAction *pAction)
 {
-    CMachine machine = session().GetMachine();
-    if (!machine.isNull())
-    {
-        gEDataManager->setRealtimeDockIconUpdateMonitor(pAction->data().toInt(), vboxGlobal().managedVMUuid());
-        updateDockOverlay();
-    }
+    gEDataManager->setRealtimeDockIconUpdateMonitor(pAction->data().toInt(), vboxGlobal().managedVMUuid());
+    updateDockOverlay();
 }
 
@@ -1925,7 +1924,6 @@
         {
             m_pDockPreviewSelectMonitorGroup->setEnabled(fEnabled);
-            CMachine machine = session().GetMachine();
             m_DockIconPreviewMonitor = qMin(gEDataManager->realtimeDockIconUpdateMonitor(vboxGlobal().managedVMUuid()),
-                                            (int)machine.GetMonitorCount() - 1);
+                                            (int)machine().GetMonitorCount() - 1);
         }
         /* Resize the dock icon in the case the preview monitor has changed. */
@@ -1943,5 +1941,5 @@
 //    printf("%s: UIMachineLogic: sltSwitchKeyboardLedsToGuestLeds called, machine name is {%s}\n",
 //           strDt.toAscii().constData(),
-//           session().GetMachine().GetName().toAscii().constData());
+//           machineName().toAscii().constData());
 
     /* Here we have to store host LED lock states. */
@@ -1974,5 +1972,5 @@
 //    printf("%s: UIMachineLogic: sltSwitchKeyboardLedsToPreviousLeds called, machine name is {%s}\n",
 //           strDt.toAscii().constData(),
-//           session().GetMachine().GetName().toAscii().constData());
+//           machineName().toAscii().constData());
 
     if (!isHidLedsSyncEnabled())
@@ -2019,9 +2017,8 @@
 
     /* Prepare/fill all storage menus: */
-    const CMachine machine = session().GetMachine();
-    foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments())
+    foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())
     {
         /* Current controller: */
-        const CStorageController controller = machine.GetStorageControllerByName(attachment.GetController());
+        const CStorageController controller = machine().GetStorageControllerByName(attachment.GetController());
         /* If controller present and device-type correct: */
         if (!controller.isNull() && attachment.GetType() == deviceType)
@@ -2056,5 +2053,5 @@
             vboxGlobal().prepareStorageMenu(*pStorageMenu,
                                             this, SLOT(sltMountStorageMedium()),
-                                            machine, strControllerName, storageSlot);
+                                            machine(), strControllerName, storageSlot);
         }
     }
@@ -2063,10 +2060,6 @@
 void UIMachineLogic::updateMenuDevicesNetwork(QMenu *pMenu)
 {
-    /* Get and check current machine: */
-    const CMachine machine = session().GetMachine();
-    AssertReturnVoid(!machine.isNull());
-
     /* Determine how many adapters we should display: */
-    const KChipsetType chipsetType = machine.GetChipsetType();
+    const KChipsetType chipsetType = machine().GetChipsetType();
     const ULONG uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType));
 
@@ -2076,6 +2069,6 @@
     {
         /* Get and check iterated adapter: */
-        const CNetworkAdapter adapter = machine.GetNetworkAdapter(uSlot);
-        AssertReturnVoid(machine.isOk() && !adapter.isNull());
+        const CNetworkAdapter adapter = machine().GetNetworkAdapter(uSlot);
+        AssertReturnVoid(machine().isOk() && !adapter.isNull());
 
         /* Skip disabled adapters: */
@@ -2136,6 +2129,5 @@
 
             /* Check if that USB device was already attached to this session: */
-            CConsole console = session().GetConsole();
-            const CUSBDevice attachedDevice = console.FindUSBDeviceById(device.GetId());
+            const CUSBDevice attachedDevice = console().FindUSBDeviceById(device.GetId());
             pAttachUSBAction->setChecked(!attachedDevice.isNull());
             pAttachUSBAction->setEnabled(hostDevice.GetState() != KUSBDeviceState_Unavailable);
@@ -2171,5 +2163,5 @@
     {
         /* Populate menu with host webcams: */
-        const QVector<QString> attachedWebcamPaths = session().GetConsole().GetEmulatedUSB().GetWebcams();
+        const QVector<QString> attachedWebcamPaths = console().GetEmulatedUSB().GetWebcams();
         foreach (const CHostVideoInputDevice &webcam, webcams)
         {
@@ -2206,5 +2198,5 @@
             pAction->setData(QVariant::fromValue(mode));
             pAction->setCheckable(true);
-            pAction->setChecked(session().GetMachine().GetClipboardMode() == mode);
+            pAction->setChecked(machine().GetClipboardMode() == mode);
         }
         connect(m_pSharedClipboardActions, SIGNAL(triggered(QAction*)),
@@ -2214,5 +2206,5 @@
     else
         foreach (QAction *pAction, m_pSharedClipboardActions->actions())
-            if (pAction->data().value<KClipboardMode>() == session().GetMachine().GetClipboardMode())
+            if (pAction->data().value<KClipboardMode>() == machine().GetClipboardMode())
                 pAction->setChecked(true);
 }
@@ -2231,5 +2223,5 @@
             pAction->setData(QVariant::fromValue(mode));
             pAction->setCheckable(true);
-            pAction->setChecked(session().GetMachine().GetDnDMode() == mode);
+            pAction->setChecked(machine().GetDnDMode() == mode);
         }
         connect(m_pDragAndDropActions, SIGNAL(triggered(QAction*)),
@@ -2239,5 +2231,5 @@
     else
         foreach (QAction *pAction, m_pDragAndDropActions->actions())
-            if (pAction->data().value<KDnDMode>() == session().GetMachine().GetDnDMode())
+            if (pAction->data().value<KDnDMode>() == machine().GetDnDMode())
                 pAction->setChecked(true);
 }
@@ -2249,13 +2241,8 @@
     bool fEnabled = false;
     bool fChecked = false;
-    const CConsole console = session().GetConsole();
-    if (console.isOk())
-    {
-        const CMachineDebugger cdebugger = console.GetDebugger();
-        if (console.isOk())
-        {
-            fEnabled = true;
-            fChecked = cdebugger.GetLogEnabled() != FALSE;
-        }
+    if (!debugger().isNull() && debugger().isOk())
+    {
+        fEnabled = true;
+        fChecked = debugger().GetLogEnabled() != FALSE;
     }
     if (fEnabled != actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->isEnabled())
@@ -2328,7 +2315,5 @@
 {
     /* Get console: */
-    const CConsole &console = session().GetConsole();
-    CDisplay display = console.GetDisplay();
-    const int cGuestScreens = uisession()->session().GetMachine().GetMonitorCount();
+    const int cGuestScreens = machine().GetMonitorCount();
     QList<QImage> images;
     ULONG uMaxWidth  = 0;
@@ -2344,9 +2329,9 @@
         LONG yOrigin = 0;
         KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
-        display.GetScreenResolution(i, width, height, bpp, xOrigin, yOrigin, monitorStatus);
+        display().GetScreenResolution(i, width, height, bpp, xOrigin, yOrigin, monitorStatus);
         uMaxWidth  += width;
         uMaxHeight  = RT_MAX(uMaxHeight, height);
         QImage shot = QImage(width, height, QImage::Format_RGB32);
-        display.TakeScreenShot(i, shot.bits(), shot.width(), shot.height(), KBitmapFormat_BGR0);
+        display().TakeScreenShot(i, shot.bits(), shot.width(), shot.height(), KBitmapFormat_BGR0);
         images << shot;
     }
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h	(revision 53029)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h	(revision 53030)
@@ -40,4 +40,10 @@
 class CSession;
 class CMachine;
+class CConsole;
+class CDisplay;
+class CGuest;
+class CMouse;
+class CKeyboard;
+class CMachineDebugger;
 class CSnapshot;
 class CUSBDevice;
@@ -81,5 +87,25 @@
     UISession* uisession() const { return m_pSession; }
     UIActionPool* actionPool() const;
+
+    /** Returns the session reference. */
     CSession& session() const;
+    /** Returns the session's machine reference. */
+    CMachine& machine() const;
+    /** Returns the session's console reference. */
+    CConsole& console() const;
+    /** Returns the console's display reference. */
+    CDisplay& display() const;
+    /** Returns the console's guest reference. */
+    CGuest& guest() const;
+    /** Returns the console's mouse reference. */
+    CMouse& mouse() const;
+    /** Returns the console's keyboard reference. */
+    CKeyboard& keyboard() const;
+    /** Returns the console's debugger reference. */
+    CMachineDebugger& debugger() const;
+
+    /** Returns the machine name. */
+    const QString& machineName() const;
+
     UIVisualStateType visualStateType() const { return m_visualStateType; }
     const QList<UIMachineWindow*>& machineWindows() const { return m_machineWindowsList; }
