Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp	(revision 65233)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp	(revision 65234)
@@ -48,4 +48,6 @@
 UIMultiScreenLayout::UIMultiScreenLayout(UIMachineLogic *pMachineLogic)
     : m_pMachineLogic(pMachineLogic)
+    , m_cGuestScreens(m_pMachineLogic->machine().GetMonitorCount())
+    , m_cHostScreens(0)
 {
     /* Calculate host/guest screen count: */
@@ -69,5 +71,4 @@
      * We have to make sure they are valid, which means there have to be unique combinations
      * and all guests screens need there own host screen. */
-    CDisplay display = m_pMachineLogic->session().GetConsole().GetDisplay();
     bool fShouldWeAutoMountGuestScreens = gEDataManager->autoMountGuestScreensEnabled(vboxGlobal().managedVMUuid());
     LogRel(("GUI: UIMultiScreenLayout::update: GUI/AutomountGuestScreens is %s\n", fShouldWeAutoMountGuestScreens ? "enabled" : "disabled"));
@@ -130,5 +131,5 @@
             /* Then we have to disable excessive guest-screen: */
             LogRel(("GUI: UIMultiScreenLayout::update: Disabling excessive guest-screen %d\n", iGuestScreen));
-            display.SetVideoModeHint(iGuestScreen, false, false, 0, 0, 0, 0, 0);
+            m_pMachineLogic->display().SetVideoModeHint(iGuestScreen, false, false, 0, 0, 0, 0, 0);
             m_pMachineLogic->uisession()->setScreenVisibleHostDesires(iGuestScreen, false);
         }
@@ -164,5 +165,5 @@
             LogRel(("GUI: UIMultiScreenLayout::update: Enabling guest-screen %d with following resolution: %dx%d\n",
                     iGuestScreen, uWidth, uHeight));
-            display.SetVideoModeHint(iGuestScreen, true, false, 0, 0, uWidth, uHeight, 32);
+            m_pMachineLogic->display().SetVideoModeHint(iGuestScreen, true, false, 0, 0, uWidth, uHeight, 32);
             m_pMachineLogic->uisession()->setScreenVisibleHostDesires(iGuestScreen, true);
         }
@@ -227,8 +228,7 @@
     /* Check the memory requirements first: */
     bool fSuccess = true;
-    CMachine machine = m_pMachineLogic->session().GetMachine();
     if (m_pMachineLogic->uisession()->isGuestSupportsGraphics())
     {
-        quint64 availBits = machine.GetVRAMSize() * _1M * 8;
+        quint64 availBits = m_pMachineLogic->machine().GetVRAMSize() * _1M * 8;
         quint64 usedBits = memoryRequirements(tmpMap);
         fSuccess = availBits >= usedBits;
@@ -263,10 +263,8 @@
 void UIMultiScreenLayout::calculateGuestScreenCount()
 {
-    /* Get machine: */
-    CMachine machine = m_pMachineLogic->session().GetMachine();
     /* Enumerate all the guest screens: */
     m_guestScreens.clear();
     m_disabledGuestScreens.clear();
-    for (uint iGuestScreen = 0; iGuestScreen < machine.GetMonitorCount(); ++iGuestScreen)
+    for (uint iGuestScreen = 0; iGuestScreen < m_cGuestScreens; ++iGuestScreen)
         if (m_pMachineLogic->uisession()->isScreenVisible(iGuestScreen))
             m_guestScreens << iGuestScreen;
@@ -292,5 +290,4 @@
     LONG yOrigin = 0;
     quint64 usedBits = 0;
-    CDisplay display = m_pMachineLogic->uisession()->session().GetConsole().GetDisplay();
     foreach (int iGuestScreen, m_guestScreens)
     {
@@ -301,5 +298,5 @@
             screen = gpDesktop->screenGeometry(screenLayout.value(iGuestScreen, 0));
         KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
-        display.GetScreenResolution(iGuestScreen, width, height, guestBpp, xOrigin, yOrigin, monitorStatus);
+        m_pMachineLogic->display().GetScreenResolution(iGuestScreen, width, height, guestBpp, xOrigin, yOrigin, monitorStatus);
         usedBits += screen.width() * /* display width */
                     screen.height() * /* display height */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h	(revision 65233)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h	(revision 65234)
@@ -75,4 +75,5 @@
     QList<int> m_guestScreens;
     QList<int> m_disabledGuestScreens;
+    const uint m_cGuestScreens;
     int m_cHostScreens;
     QMap<int, int> m_screenMap;
