Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	(revision 66501)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp	(revision 66502)
@@ -59,4 +59,5 @@
 # include "CAudioAdapter.h"
 # include "CParallelPort.h"
+# include "CSerialPort.h"
 # include "CConsole.h"
 # include "CMachine.h"
@@ -1235,4 +1236,18 @@
     error(pParent, MessageType_Error,
           tr("Cannot save parallel port settings."),
+          formatErrorInfo(comPort));
+}
+
+void UIMessageCenter::cannotSaveSerialSettings(const CMachine &comMachine, QWidget *pParent /* = 0 */)
+{
+    error(pParent, MessageType_Error,
+          tr("Cannot save serial ports settings."),
+          formatErrorInfo(comMachine));
+}
+
+void UIMessageCenter::cannotSaveSerialPortSettings(const CSerialPort &comPort, QWidget *pParent /* = 0 */)
+{
+    error(pParent, MessageType_Error,
+          tr("Cannot save serial port settings."),
           formatErrorInfo(comPort));
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h	(revision 66501)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h	(revision 66502)
@@ -251,4 +251,6 @@
     void cannotSaveParallelSettings(const CMachine &comMachine, QWidget *pParent = 0);
     void cannotSaveParallelPortSettings(const CParallelPort &comPort, QWidget *pParent = 0);
+    void cannotSaveSerialSettings(const CMachine &comMachine, QWidget *pParent = 0);
+    void cannotSaveSerialPortSettings(const CSerialPort &comPort, QWidget *pParent = 0);
     void cannotAttachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0);
     bool warnAboutIncorrectPort(QWidget *pParent = 0) const;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp	(revision 66501)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp	(revision 66502)
@@ -28,4 +28,5 @@
 # include "UIConverter.h"
 # include "UIMachineSettingsSerial.h"
+# include "UIMessageCenter.h"
 # include "VBoxGlobal.h"
 
@@ -459,53 +460,6 @@
     UISettingsPageMachine::fetchData(data);
 
-    /* Make sure machine is offline & serial data was changed: */
-    if (isMachineOffline() && m_pCache->wasChanged())
-    {
-        /* For each serial port: */
-        for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
-        {
-            /* Get old serial data from the cache: */
-            const UIDataSettingsMachineSerialPort &oldPortData = m_pCache->base().m_ports.at(iPort);
-            /* Get new serial data from the cache: */
-            const UIDataSettingsMachineSerialPort &newPortData = m_pCache->data().m_ports.at(iPort);
-
-            /* Make sure port data was changed: */
-            if (newPortData != oldPortData)
-            {
-                /* Check if port still valid: */
-                CSerialPort comPort = m_machine.GetSerialPort(iPort);
-                /* Store new adapter data: */
-                if (!comPort.isNull())
-                {
-                    /* Whether the port is enabled: */
-                    if (   comPort.isOk()
-                        && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled)
-                        comPort.SetEnabled(newPortData.m_fPortEnabled);
-                    /* Port IRQ: */
-                    if (   comPort.isOk()
-                        && newPortData.m_uIRQ != oldPortData.m_uIRQ)
-                        comPort.SetIRQ(newPortData.m_uIRQ);
-                    /* Port IO base: */
-                    if (   comPort.isOk()
-                        && newPortData.m_uIOBase != oldPortData.m_uIOBase)
-                        comPort.SetIOBase(newPortData.m_uIOBase);
-                    /* Whether the port is server: */
-                    if (   comPort.isOk()
-                        && newPortData.m_fServer != oldPortData.m_fServer)
-                        comPort.SetServer(newPortData.m_fServer);
-                    /* Port path: */
-                    if (   comPort.isOk()
-                        && newPortData.m_strPath != oldPortData.m_strPath)
-                        comPort.SetPath(newPortData.m_strPath);
-                    /* This *must* be last. The host mode will be changed to disconnected if
-                     * some of the necessary settings above will not meet the requirements for
-                     * the selected mode. */
-                    if (   comPort.isOk()
-                        && newPortData.m_hostMode != oldPortData.m_hostMode)
-                        comPort.SetHostMode(newPortData.m_hostMode);
-                }
-            }
-        }
-    }
+    /* Update serial data and failing state: */
+    setFailed(!saveSerialData());
 
     /* Upload machine to data: */
@@ -656,4 +610,102 @@
 }
 
+bool UIMachineSettingsSerialPage::saveSerialData()
+{
+    /* Prepare result: */
+    bool fSuccess = true;
+    /* Save serial settings from the cache: */
+    if (fSuccess && isMachineInValidMode() && m_pCache->wasChanged())
+    {
+        /* For each port: */
+        for (int iSlot = 0; fSuccess && iSlot < m_pTabWidget->count(); ++iSlot)
+            fSuccess = savePortData(iSlot);
+    }
+    /* Return result: */
+    return fSuccess;
+}
+
+bool UIMachineSettingsSerialPage::savePortData(int iPort)
+{
+    /* Prepare result: */
+    bool fSuccess = true;
+    /* Save adapter settings from the cache: */
+    if (fSuccess)
+    {
+        /* Get old serial data from the cache: */
+        const UIDataSettingsMachineSerialPort &oldPortData = m_pCache->base().m_ports.at(iPort);
+        /* Get new serial data from the cache: */
+        const UIDataSettingsMachineSerialPort &newPortData = m_pCache->data().m_ports.at(iPort);
+
+        /* Make sure port data was changed: */
+        if (newPortData != oldPortData)
+        {
+            /* Get serial port for further activities: */
+            CSerialPort comPort = m_machine.GetSerialPort(iPort);
+            fSuccess = m_machine.isOk() && comPort.isNotNull();
+            /* Show error message if necessary: */
+            if (!fSuccess)
+                msgCenter().cannotSaveSerialSettings(m_machine, this);
+
+            // This *must* be first.
+            // If the requested host mode is changed to disconnected we should do it first.
+            // That allows to automatically fulfill the requirements for some of the settings below.
+            /* Save port host mode: */
+            if (   fSuccess && isMachineOffline()
+                && newPortData.m_hostMode != oldPortData.m_hostMode
+                && newPortData.m_hostMode == KPortMode_Disconnected)
+            {
+                comPort.SetHostMode(newPortData.m_hostMode);
+                fSuccess = comPort.isOk();
+            }
+            /* Save whether the port is enabled: */
+            if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled)
+            {
+                comPort.SetEnabled(newPortData.m_fPortEnabled);
+                fSuccess = comPort.isOk();
+            }
+            /* Save port IRQ: */
+            if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ)
+            {
+                comPort.SetIRQ(newPortData.m_uIRQ);
+                fSuccess = comPort.isOk();
+            }
+            /* Save port IO base: */
+            if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase)
+            {
+                comPort.SetIOBase(newPortData.m_uIOBase);
+                fSuccess = comPort.isOk();
+            }
+            /* Save whether the port is server: */
+            if (fSuccess && isMachineOffline() && newPortData.m_fServer != oldPortData.m_fServer)
+            {
+                comPort.SetServer(newPortData.m_fServer);
+                fSuccess = comPort.isOk();
+            }
+            /* Save port path: */
+            if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)
+            {
+                comPort.SetPath(newPortData.m_strPath);
+                fSuccess = comPort.isOk();
+            }
+            // This *must* be last.
+            // The host mode will be changed to disconnected if some of the necessary
+            // settings above will not meet the requirements for the selected mode.
+            /* Save port host mode: */
+            if (   fSuccess && isMachineOffline()
+                && newPortData.m_hostMode != oldPortData.m_hostMode
+                && newPortData.m_hostMode != KPortMode_Disconnected)
+            {
+                comPort.SetHostMode(newPortData.m_hostMode);
+                fSuccess = comPort.isOk();
+            }
+            /* Show error message if necessary: */
+            if (!fSuccess)
+                msgCenter().cannotSaveSerialPortSettings(comPort, this);
+        }
+    }
+    /* Return result: */
+    return fSuccess;
+}
+
 # include "UIMachineSettingsSerial.moc"
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h	(revision 66501)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h	(revision 66502)
@@ -77,4 +77,9 @@
     void cleanup();
 
+    /** Saves existing serial data from the cache. */
+    bool saveSerialData();
+    /** Saves existing port data from the cache. */
+    bool savePortData(int iPort);
+
     /** Holds the tab-widget instance. */
     QITabWidget *m_pTabWidget;
