Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 66659)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp	(revision 66660)
@@ -1554,6 +1554,6 @@
 
     /* Assign corresponding icon: */
-    const QPixmap pixmap = vboxGlobal().vmGuestOSTypePixmapDefault(guest().GetOSTypeId());
-    pDlg->mLbIcon->setPixmap(pixmap);
+    if (uisession() && uisession()->machineWindowIcon())
+        pDlg->mLbIcon->setPixmap(uisession()->machineWindowIcon()->pixmap(QSize(32, 32)));
 
     /* Search for the max available filter index: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp	(revision 66659)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp	(revision 66660)
@@ -182,16 +182,8 @@
 {
 #ifndef VBOX_WS_MAC
-    /* On Mac OS X window icon referenced in info.plist is used. */
-
-    /* Set default window icon (will be changed to VM-specific icon little bit later): */
-    setWindowIcon(QIcon(":/VirtualBox_48px.png"));
-
-    /* Set redefined machine-window icon if any: */
-    QIcon *pMachineWidnowIcon = uisession()->machineWindowIcon();
-    if (pMachineWidnowIcon)
-        setWindowIcon(*pMachineWidnowIcon);
-    /* Or set default machine-window icon: */
-    else
-        setWindowIcon(vboxGlobal().vmGuestOSTypeIcon(machine().GetOSTypeId()));
+    /* Set machine-window icon if any: */
+    // On macOS window icon is referenced in info.plist.
+    if (uisession() && uisession()->machineWindowIcon())
+        setWindowIcon(*uisession()->machineWindowIcon());
 #endif /* !VBOX_WS_MAC */
 }
@@ -346,4 +338,7 @@
                                                                   console().GetGuestEnteredACPIMode(),
                                                                   restrictedCloseActions);
+        /* Configure close-dialog: */
+        if (uisession() && uisession()->machineWindowIcon())
+            pCloseDlg->setPixmap(uisession()->machineWindowIcon()->pixmap(QSize(32, 32)));
 
         /* Make sure close-dialog is valid: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 66659)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 66660)
@@ -957,7 +957,5 @@
     , m_machineStatePrevious(KMachineState_Null)
     , m_machineState(KMachineState_Null)
-#ifndef VBOX_WS_MAC
     , m_pMachineWindowIcon(0)
-#endif /* !VBOX_WS_MAC */
     , m_requestedVisualStateType(UIVisualStateType_Invalid)
 #ifdef VBOX_WS_WIN
@@ -1289,16 +1287,27 @@
         const QString strMachineID = vboxGlobal().managedVMUuid();
 
+        /* Prepare machine-window icon: */
+        {
+            QIcon icon;
 #ifndef VBOX_WS_MAC
-        /* Load/prepare user's machine-window icon: */
-        QIcon icon;
-        foreach (const QString &strIconName, gEDataManager->machineWindowIconNames(strMachineID))
-            if (!strIconName.isEmpty() && QFile::exists(strIconName))
-                icon.addFile(strIconName);
-        if (!icon.isNull())
+            /* Load user machine-window icon: */
+            foreach (const QString &strIconName, gEDataManager->machineWindowIconNames(strMachineID))
+                if (!strIconName.isEmpty() && QFile::exists(strIconName))
+                    icon.addFile(strIconName);
+#endif
+            /* Use the OS type icon if user one was not set: */
+            if (icon.isNull())
+                icon = vboxGlobal().vmGuestOSTypeIcon(machine().GetOSTypeId());
+            /* Use the default icon if nothing else works: */
+            if (icon.isNull())
+                icon = QIcon(":/VirtualBox_48px.png");
+            /* Store the icon dynamically: */
             m_pMachineWindowIcon = new QIcon(icon);
-
+        }
+
+#ifndef VBOX_WS_MAC
         /* Load user's machine-window name postfix: */
         m_strMachineWindowNamePostfix = gEDataManager->machineWindowNamePostfix(strMachineID);
-#endif /* !VBOX_WS_MAC */
+#endif
 
         /* Is there should be First RUN Wizard? */
@@ -1368,9 +1377,7 @@
         }
 
-#ifndef VBOX_WS_MAC
-        /* Cleanup user's machine-window icon: */
+        /* Cleanup machine-window icon: */
         delete m_pMachineWindowIcon;
         m_pMachineWindowIcon = 0;
-#endif /* !VBOX_WS_MAC */
     }
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h	(revision 66659)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h	(revision 66660)
@@ -128,13 +128,13 @@
     QCursor cursor() const { return m_cursor; }
 
-#ifndef VBOX_WS_MAC
     /** @name Branding stuff.
      ** @{ */
-    /** Returns redefined machine-window icon. */
-    QIcon* machineWindowIcon() const { return m_pMachineWindowIcon; }
+    /** Returns the cached machine-window icon. */
+    QIcon *machineWindowIcon() const { return m_pMachineWindowIcon; }
+#ifndef VBOX_WS_MAC
     /** Returns redefined machine-window name postfix. */
     QString machineWindowNamePostfix() const { return m_strMachineWindowNamePostfix; }
-    /** @} */
-#endif /* !VBOX_WS_MAC */
+#endif
+    /** @} */
 
     /** @name Host-screen configuration variables.
@@ -459,13 +459,13 @@
     QCursor m_cursor;
 
-#ifndef VBOX_WS_MAC
     /** @name Branding variables.
      ** @{ */
-    /** Holds redefined machine-window icon. */
+    /** Holds the cached machine-window icon. */
     QIcon *m_pMachineWindowIcon;
+#ifndef VBOX_WS_MAC
     /** Holds redefined machine-window name postfix. */
     QString m_strMachineWindowNamePostfix;
-    /** @} */
-#endif /* !VBOX_WS_MAC */
+#endif
+    /** @} */
 
     /** @name Visual-state configuration variables.
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp	(revision 66659)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp	(revision 66660)
@@ -70,4 +70,14 @@
 }
 
+void UIVMCloseDialog::setPixmap(const QPixmap &pixmap)
+{
+    /* Make sure pixmap is valid: */
+    if (pixmap.isNull())
+        return;
+
+    /* Assign new pixmap: */
+    m_pIcon->setPixmap(pixmap);
+}
+
 void UIVMCloseDialog::sltUpdateWidgetAvailability()
 {
@@ -103,14 +113,4 @@
     /* Hide the dialog: */
     hide();
-}
-
-void UIVMCloseDialog::setPixmap(const QPixmap &pixmap)
-{
-    /* Make sure pixmap is valid: */
-    if (pixmap.isNull())
-        return;
-
-    /* Assign new pixmap: */
-    m_pIcon->setPixmap(pixmap);
 }
 
@@ -317,7 +317,4 @@
     KMachineState machineState = m_machine.GetState();
 
-    /* Assign pixmap: */
-    setPixmap(vboxGlobal().vmGuestOSTypePixmapDefault(m_machine.GetOSTypeId()));
-
     /* Check which close-actions are resticted: */
     bool fIsDetachAllowed = vboxGlobal().isSeparateProcess() && !(m_restictedCloseActions & MachineCloseAction_Detach);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h	(revision 66659)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h	(revision 66660)
@@ -44,4 +44,7 @@
     bool isValid() const { return m_fValid; }
 
+    /* API: Pixmap stuff: */
+    void setPixmap(const QPixmap &pixmap);
+
 private slots:
 
@@ -53,7 +56,4 @@
 
 private:
-
-    /* API: Pixmap stuff: */
-    void setPixmap(const QPixmap &pixmap);
 
     /* API: Detach-button stuff: */
