Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp	(revision 66555)
@@ -270,29 +270,33 @@
         CAudioAdapter comAdapter = m_machine.GetAudioAdapter();
         fSuccess = m_machine.isOk() && comAdapter.isNotNull();
+
         /* Show error message if necessary: */
         if (!fSuccess)
             msgCenter().cannotSaveAudioSettings(m_machine, this);
-
-        /* Save whether audio is enabled: */
-        if (fSuccess && isMachineOffline() && newAudioData.m_fAudioEnabled != oldAudioData.m_fAudioEnabled)
+        else
         {
-            comAdapter.SetEnabled(newAudioData.m_fAudioEnabled);
-            fSuccess = comAdapter.isOk();
+            /* Save whether audio is enabled: */
+            if (fSuccess && isMachineOffline() && newAudioData.m_fAudioEnabled != oldAudioData.m_fAudioEnabled)
+            {
+                comAdapter.SetEnabled(newAudioData.m_fAudioEnabled);
+                fSuccess = comAdapter.isOk();
+            }
+            /* Save audio driver type: */
+            if (fSuccess && isMachineOffline() && newAudioData.m_audioDriverType != oldAudioData.m_audioDriverType)
+            {
+                comAdapter.SetAudioDriver(newAudioData.m_audioDriverType);
+                fSuccess = comAdapter.isOk();
+            }
+            /* Save audio controller type: */
+            if (fSuccess && isMachineOffline() && newAudioData.m_audioControllerType != oldAudioData.m_audioControllerType)
+            {
+                comAdapter.SetAudioController(newAudioData.m_audioControllerType);
+                fSuccess = comAdapter.isOk();
+            }
+
+            /* Show error message if necessary: */
+            if (!fSuccess)
+                msgCenter().cannotSaveAudioAdapterSettings(comAdapter, this);
         }
-        /* Save audio driver type: */
-        if (fSuccess && isMachineOffline() && newAudioData.m_audioDriverType != oldAudioData.m_audioDriverType)
-        {
-            comAdapter.SetAudioDriver(newAudioData.m_audioDriverType);
-            fSuccess = comAdapter.isOk();
-        }
-        /* Save audio controller type: */
-        if (fSuccess && isMachineOffline() && newAudioData.m_audioControllerType != oldAudioData.m_audioControllerType)
-        {
-            comAdapter.SetAudioController(newAudioData.m_audioControllerType);
-            fSuccess = comAdapter.isOk();
-        }
-        /* Show error message if necessary: */
-        if (!fSuccess)
-            msgCenter().cannotSaveAudioAdapterSettings(comAdapter, this);
     }
     /* Return result: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp	(revision 66555)
@@ -1264,4 +1264,5 @@
         }
 #endif
+
         /* Get machine ID for further activities: */
         QString strMachineId;
@@ -1271,4 +1272,5 @@
             fSuccess = m_machine.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -1303,43 +1305,47 @@
         CVRDEServer comServer = m_machine.GetVRDEServer();
         fSuccess = m_machine.isOk() && comServer.isNotNull();
+
         /* Show error message if necessary: */
         if (!fSuccess)
             msgCenter().cannotSaveDisplaySettings(m_machine, this);
-
-        /* Save whether remote display server is enabled: */
-        if (fSuccess && newDisplayData.m_fRemoteDisplayServerEnabled != oldDisplayData.m_fRemoteDisplayServerEnabled)
-        {
-            comServer.SetEnabled(newDisplayData.m_fRemoteDisplayServerEnabled);
-            fSuccess = comServer.isOk();
-        }
-        /* Save remote display server port: */
-        if (fSuccess && newDisplayData.m_strRemoteDisplayPort != oldDisplayData.m_strRemoteDisplayPort)
-        {
-            comServer.SetVRDEProperty("TCP/Ports", newDisplayData.m_strRemoteDisplayPort);
-            fSuccess = comServer.isOk();
-        }
-        /* Save remote display server auth type: */
-        if (fSuccess && newDisplayData.m_remoteDisplayAuthType != oldDisplayData.m_remoteDisplayAuthType)
-        {
-            comServer.SetAuthType(newDisplayData.m_remoteDisplayAuthType);
-            fSuccess = comServer.isOk();
-        }
-        /* Save remote display server timeout: */
-        if (fSuccess && newDisplayData.m_uRemoteDisplayTimeout != oldDisplayData.m_uRemoteDisplayTimeout)
-        {
-            comServer.SetAuthTimeout(newDisplayData.m_uRemoteDisplayTimeout);
-            fSuccess = comServer.isOk();
-        }
-        /* Save whether remote display server allows multiple connections: */
-        if (   fSuccess
-            && (isMachineOffline() || isMachineSaved())
-            && (newDisplayData.m_fRemoteDisplayMultiConnAllowed != oldDisplayData.m_fRemoteDisplayMultiConnAllowed))
-        {
-            comServer.SetAllowMultiConnection(newDisplayData.m_fRemoteDisplayMultiConnAllowed);
-            fSuccess = comServer.isOk();
-        }
-        /* Show error message if necessary: */
-        if (!fSuccess)
-            msgCenter().cannotSaveRemoteDisplayServerSettings(comServer, this);
+        else
+        {
+            /* Save whether remote display server is enabled: */
+            if (fSuccess && newDisplayData.m_fRemoteDisplayServerEnabled != oldDisplayData.m_fRemoteDisplayServerEnabled)
+            {
+                comServer.SetEnabled(newDisplayData.m_fRemoteDisplayServerEnabled);
+                fSuccess = comServer.isOk();
+            }
+            /* Save remote display server port: */
+            if (fSuccess && newDisplayData.m_strRemoteDisplayPort != oldDisplayData.m_strRemoteDisplayPort)
+            {
+                comServer.SetVRDEProperty("TCP/Ports", newDisplayData.m_strRemoteDisplayPort);
+                fSuccess = comServer.isOk();
+            }
+            /* Save remote display server auth type: */
+            if (fSuccess && newDisplayData.m_remoteDisplayAuthType != oldDisplayData.m_remoteDisplayAuthType)
+            {
+                comServer.SetAuthType(newDisplayData.m_remoteDisplayAuthType);
+                fSuccess = comServer.isOk();
+            }
+            /* Save remote display server timeout: */
+            if (fSuccess && newDisplayData.m_uRemoteDisplayTimeout != oldDisplayData.m_uRemoteDisplayTimeout)
+            {
+                comServer.SetAuthTimeout(newDisplayData.m_uRemoteDisplayTimeout);
+                fSuccess = comServer.isOk();
+            }
+            /* Save whether remote display server allows multiple connections: */
+            if (   fSuccess
+                && (isMachineOffline() || isMachineSaved())
+                && (newDisplayData.m_fRemoteDisplayMultiConnAllowed != oldDisplayData.m_fRemoteDisplayMultiConnAllowed))
+            {
+                comServer.SetAllowMultiConnection(newDisplayData.m_fRemoteDisplayMultiConnAllowed);
+                fSuccess = comServer.isOk();
+            }
+
+            /* Show error message if necessary: */
+            if (!fSuccess)
+                msgCenter().cannotSaveRemoteDisplayServerSettings(comServer, this);
+        }
     }
     /* Return result: */
@@ -1476,4 +1482,5 @@
             }
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp	(revision 66555)
@@ -713,8 +713,9 @@
                 fSuccess = m_machine.isOk();
             }
-            /* Show error message if necessary: */
-            if (!fSuccess)
-                msgCenter().cannotSaveGeneralSettings(m_machine, this);
-        }
+        }
+
+        /* Show error message if necessary: */
+        if (!fSuccess)
+            msgCenter().cannotSaveGeneralSettings(m_machine, this);
     }
     /* Return result: */
@@ -760,4 +761,5 @@
             fSuccess = m_machine.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -786,4 +788,5 @@
             fSuccess = m_machine.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -828,9 +831,10 @@
                 fSuccess = m_machine.isOk();
             }
+
             /* Show error message if necessary: */
             if (!fSuccess)
                 msgCenter().cannotSaveGeneralSettings(m_machine, this);
 
-            /* Enumerate attachments: */
+            /* For each attachment: */
             for (int iIndex = 0; fSuccess && iIndex < attachments.size(); ++iIndex)
             {
@@ -852,95 +856,98 @@
                     fSuccess = comAttachment.isOk();
                 }
+
                 /* Show error message if necessary: */
                 if (!fSuccess)
                     msgCenter().cannotSaveStorageAttachmentSettings(comAttachment, this);
-
-                /* Enumerate hard-drives only: */
-                if (enmType != KDeviceType_HardDisk)
-                    continue;
-
-                /* Get medium id for further activities: */
-                QString strMediumId;
-                if (fSuccess)
+                else
                 {
-                    strMediumId = comMedium.GetId();
-                    fSuccess = comMedium.isOk();
+                    /* Pass hard-drives only: */
+                    if (enmType != KDeviceType_HardDisk)
+                        continue;
+
+                    /* Get medium id for further activities: */
+                    QString strMediumId;
+                    if (fSuccess)
+                    {
+                        strMediumId = comMedium.GetId();
+                        fSuccess = comMedium.isOk();
+                    }
+
+                    /* Create encryption update progress: */
+                    CProgress comProgress;
+                    if (fSuccess)
+                    {
+                        /* Cipher attribute changed? */
+                        QString strNewCipher;
+                        if (newGeneralData.m_fEncryptionCipherChanged)
+                        {
+                            strNewCipher = newGeneralData.m_fEncryptionEnabled ?
+                                           m_encryptionCiphers.at(newGeneralData.m_iEncryptionCipherIndex) : QString();
+                        }
+
+                        /* Password attribute changed? */
+                        QString strNewPassword;
+                        QString strNewPasswordId;
+                        if (newGeneralData.m_fEncryptionPasswordChanged)
+                        {
+                            strNewPassword = newGeneralData.m_fEncryptionEnabled ?
+                                             newGeneralData.m_strEncryptionPassword : QString();
+                            strNewPasswordId = newGeneralData.m_fEncryptionEnabled ?
+                                               strMachineName : QString();
+                        }
+
+                        /* Get the maps of encrypted mediums and their passwords: */
+                        const EncryptedMediumMap &encryptedMedium = newGeneralData.m_encryptedMediums;
+                        const EncryptionPasswordMap &encryptionPasswords = newGeneralData.m_encryptionPasswords;
+
+                        /* Check if old password exists/provided: */
+                        const QString strOldPasswordId = encryptedMedium.key(strMediumId);
+                        const QString strOldPassword = encryptionPasswords.value(strOldPasswordId);
+
+                        /* Create encryption progress: */
+                        comProgress = comMedium.ChangeEncryption(strOldPassword,
+                                                                 strNewCipher,
+                                                                 strNewPassword,
+                                                                 strNewPasswordId);
+                        fSuccess = comMedium.isOk();
+                    }
+
+                    // TODO: Decide what to do with it (also below).
+                    // if (!comMedium.isOk())
+                    // {
+                    //     QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection,
+                    //                               Q_ARG(QString, UIMessageCenter::formatErrorInfo(comMedium)));
+                    //     continue;
+                    // }
+
+                    /* Create encryption update progress dialog: */
+                    QPointer<UIProgress> pDlg;
+                    if (fSuccess)
+                    {
+                        // TODO: Decide what to do with it (also above).
+                        // This dialog connected to settings serializer, not to message-center directly.
+                        // What's the better approach in that case? Probably connect everything to serializer?
+                        pDlg = new UIProgress(comProgress);
+                        connect(pDlg, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),
+                                this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
+                                Qt::QueuedConnection);
+                        connect(pDlg, SIGNAL(sigProgressError(QString)),
+                                this, SIGNAL(sigOperationProgressError(QString)),
+                                Qt::BlockingQueuedConnection);
+                        pDlg->run(350);
+                        if (pDlg)
+                            delete pDlg;
+                        else
+                        {
+                            // Premature application shutdown,
+                            // exit immediately:
+                            return true;
+                        }
+                    }
+
+                    /* Show error message if necessary: */
+                    if (!fSuccess)
+                        msgCenter().cannotSaveStorageMediumSettings(comMedium, this);
                 }
-
-                /* Create encryption update progress: */
-                CProgress comProgress;
-                if (fSuccess)
-                {
-                    /* Cipher attribute changed? */
-                    QString strNewCipher;
-                    if (newGeneralData.m_fEncryptionCipherChanged)
-                    {
-                        strNewCipher = newGeneralData.m_fEncryptionEnabled ?
-                                       m_encryptionCiphers.at(newGeneralData.m_iEncryptionCipherIndex) : QString();
-                    }
-
-                    /* Password attribute changed? */
-                    QString strNewPassword;
-                    QString strNewPasswordId;
-                    if (newGeneralData.m_fEncryptionPasswordChanged)
-                    {
-                        strNewPassword = newGeneralData.m_fEncryptionEnabled ?
-                                         newGeneralData.m_strEncryptionPassword : QString();
-                        strNewPasswordId = newGeneralData.m_fEncryptionEnabled ?
-                                           strMachineName : QString();
-                    }
-
-                    /* Get the maps of encrypted mediums and their passwords: */
-                    const EncryptedMediumMap &encryptedMedium = newGeneralData.m_encryptedMediums;
-                    const EncryptionPasswordMap &encryptionPasswords = newGeneralData.m_encryptionPasswords;
-
-                    /* Check if old password exists/provided: */
-                    const QString strOldPasswordId = encryptedMedium.key(strMediumId);
-                    const QString strOldPassword = encryptionPasswords.value(strOldPasswordId);
-
-                    /* Create encryption progress: */
-                    comProgress = comMedium.ChangeEncryption(strOldPassword,
-                                                             strNewCipher,
-                                                             strNewPassword,
-                                                             strNewPasswordId);
-                    fSuccess = comMedium.isOk();
-                }
-
-                // TODO: Decide what to do with it (also below).
-                // if (!comMedium.isOk())
-                // {
-                //     QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection,
-                //                               Q_ARG(QString, UIMessageCenter::formatErrorInfo(comMedium)));
-                //     continue;
-                // }
-
-                /* Create encryption update progress dialog: */
-                QPointer<UIProgress> pDlg;
-                if (fSuccess)
-                {
-                    // TODO: Decide what to do with it (also above).
-                    // This dialog connected to settings serializer, not to message-center directly.
-                    // What's the better approach in that case? Probably connect everything to serializer?
-                    pDlg = new UIProgress(comProgress);
-                    connect(pDlg, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),
-                            this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
-                            Qt::QueuedConnection);
-                    connect(pDlg, SIGNAL(sigProgressError(QString)),
-                            this, SIGNAL(sigOperationProgressError(QString)),
-                            Qt::BlockingQueuedConnection);
-                    pDlg->run(350);
-                    if (pDlg)
-                        delete pDlg;
-                    else
-                    {
-                        // Premature application shutdown,
-                        // exit immediately:
-                        return true;
-                    }
-                }
-
-                /* Show error message if necessary: */
-                if (!fSuccess)
-                    msgCenter().cannotSaveStorageMediumSettings(comMedium, this);
             }
         }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp	(revision 66555)
@@ -546,4 +546,5 @@
     m_pGenericPropertiesLabel->setEnabled(m_pParent->isMachineInValidMode());
     m_pGenericPropertiesTextEdit->setEnabled(m_pParent->isMachineInValidMode());
+    m_pCableConnectedCheckBox->setEnabled(m_pParent->isMachineInValidMode());
     m_pPortForwardingButton->setEnabled(m_pParent->isMachineInValidMode() &&
                                         attachmentType() == KNetworkAttachmentType_NAT);
@@ -1504,111 +1505,115 @@
             CNetworkAdapter comAdapter = m_machine.GetNetworkAdapter(iSlot);
             fSuccess = m_machine.isOk() && comAdapter.isNotNull();
+
             /* Show error message if necessary: */
             if (!fSuccess)
                 msgCenter().cannotSaveNetworkSettings(m_machine, this);
-
-            /* Save whether the adapter is enabled: */
-            if (fSuccess && isMachineOffline() && newAdapterData.m_fAdapterEnabled != oldAdapterData.m_fAdapterEnabled)
+            else
             {
-                comAdapter.SetEnabled(newAdapterData.m_fAdapterEnabled);
-                fSuccess = comAdapter.isOk();
+                /* Save whether the adapter is enabled: */
+                if (fSuccess && isMachineOffline() && newAdapterData.m_fAdapterEnabled != oldAdapterData.m_fAdapterEnabled)
+                {
+                    comAdapter.SetEnabled(newAdapterData.m_fAdapterEnabled);
+                    fSuccess = comAdapter.isOk();
+                }
+                /* Save adapter type: */
+                if (fSuccess && isMachineOffline() && newAdapterData.m_adapterType != oldAdapterData.m_adapterType)
+                {
+                    comAdapter.SetAdapterType(newAdapterData.m_adapterType);
+                    fSuccess = comAdapter.isOk();
+                }
+                /* Save adapter MAC address: */
+                if (fSuccess && isMachineOffline() && newAdapterData.m_strMACAddress != oldAdapterData.m_strMACAddress)
+                {
+                    comAdapter.SetMACAddress(newAdapterData.m_strMACAddress);
+                    fSuccess = comAdapter.isOk();
+                }
+                /* Save adapter attachment type: */
+                switch (newAdapterData.m_attachmentType)
+                {
+                    case KNetworkAttachmentType_Bridged:
+                    {
+                        if (fSuccess && newAdapterData.m_strBridgedAdapterName != oldAdapterData.m_strBridgedAdapterName)
+                        {
+                            comAdapter.SetBridgedInterface(newAdapterData.m_strBridgedAdapterName);
+                            fSuccess = comAdapter.isOk();
+                        }
+                        break;
+                    }
+                    case KNetworkAttachmentType_Internal:
+                    {
+                        if (fSuccess && newAdapterData.m_strInternalNetworkName != oldAdapterData.m_strInternalNetworkName)
+                        {
+                            comAdapter.SetInternalNetwork(newAdapterData.m_strInternalNetworkName);
+                            fSuccess = comAdapter.isOk();
+                        }
+                        break;
+                    }
+                    case KNetworkAttachmentType_HostOnly:
+                    {
+                        if (fSuccess && newAdapterData.m_strHostInterfaceName != oldAdapterData.m_strHostInterfaceName)
+                        {
+                            comAdapter.SetHostOnlyInterface(newAdapterData.m_strHostInterfaceName);
+                            fSuccess = comAdapter.isOk();
+                        }
+                        break;
+                    }
+                    case KNetworkAttachmentType_Generic:
+                    {
+                        if (fSuccess && newAdapterData.m_strGenericDriverName != oldAdapterData.m_strGenericDriverName)
+                        {
+                            comAdapter.SetGenericDriver(newAdapterData.m_strGenericDriverName);
+                            fSuccess = comAdapter.isOk();
+                        }
+                        if (fSuccess && newAdapterData.m_strGenericProperties != oldAdapterData.m_strGenericProperties)
+                            fSuccess = saveGenericProperties(comAdapter, newAdapterData.m_strGenericProperties);
+                        break;
+                    }
+                    case KNetworkAttachmentType_NATNetwork:
+                    {
+                        if (fSuccess && newAdapterData.m_strNATNetworkName != oldAdapterData.m_strNATNetworkName)
+                        {
+                            comAdapter.SetNATNetwork(newAdapterData.m_strNATNetworkName);
+                            fSuccess = comAdapter.isOk();
+                        }
+                        break;
+                    }
+                    default:
+                        break;
+                }
+                if (fSuccess && newAdapterData.m_attachmentType != oldAdapterData.m_attachmentType)
+                {
+                    comAdapter.SetAttachmentType(newAdapterData.m_attachmentType);
+                    fSuccess = comAdapter.isOk();
+                }
+                /* Save adapter promiscuous mode: */
+                if (fSuccess && newAdapterData.m_promiscuousMode != oldAdapterData.m_promiscuousMode)
+                {
+                    comAdapter.SetPromiscModePolicy(newAdapterData.m_promiscuousMode);
+                    fSuccess = comAdapter.isOk();
+                }
+                /* Save whether the adapter cable connected: */
+                if (fSuccess && newAdapterData.m_fCableConnected != oldAdapterData.m_fCableConnected)
+                {
+                    comAdapter.SetCableConnected(newAdapterData.m_fCableConnected);
+                    fSuccess = comAdapter.isOk();
+                }
+                /* Save adapter redirect options: */
+                if (   fSuccess && newAdapterData.m_redirects != oldAdapterData.m_redirects
+                    && (   oldAdapterData.m_attachmentType == KNetworkAttachmentType_NAT
+                        || newAdapterData.m_attachmentType == KNetworkAttachmentType_NAT))
+                {
+                    foreach (const QString &strOldRedirect, comAdapter.GetNATEngine().GetRedirects())
+                        comAdapter.GetNATEngine().RemoveRedirect(strOldRedirect.section(',', 0, 0));
+                    foreach (const UIPortForwardingData &newRedirect, newAdapterData.m_redirects)
+                        comAdapter.GetNATEngine().AddRedirect(newRedirect.name, newRedirect.protocol,
+                                                           newRedirect.hostIp, newRedirect.hostPort.value(),
+                                                           newRedirect.guestIp, newRedirect.guestPort.value());
+                }
+
+                /* Show error message if necessary: */
+                if (!fSuccess)
+                    msgCenter().cannotSaveNetworkAdapterSettings(comAdapter, this);
             }
-            /* Save adapter type: */
-            if (fSuccess && isMachineOffline() && newAdapterData.m_adapterType != oldAdapterData.m_adapterType)
-            {
-                comAdapter.SetAdapterType(newAdapterData.m_adapterType);
-                fSuccess = comAdapter.isOk();
-            }
-            /* Save adapter MAC address: */
-            if (fSuccess && isMachineOffline() && newAdapterData.m_strMACAddress != oldAdapterData.m_strMACAddress)
-            {
-                comAdapter.SetMACAddress(newAdapterData.m_strMACAddress);
-                fSuccess = comAdapter.isOk();
-            }
-            /* Save adapter attachment type: */
-            switch (newAdapterData.m_attachmentType)
-            {
-                case KNetworkAttachmentType_Bridged:
-                {
-                    if (fSuccess && newAdapterData.m_strBridgedAdapterName != oldAdapterData.m_strBridgedAdapterName)
-                    {
-                        comAdapter.SetBridgedInterface(newAdapterData.m_strBridgedAdapterName);
-                        fSuccess = comAdapter.isOk();
-                    }
-                    break;
-                }
-                case KNetworkAttachmentType_Internal:
-                {
-                    if (fSuccess && newAdapterData.m_strInternalNetworkName != oldAdapterData.m_strInternalNetworkName)
-                    {
-                        comAdapter.SetInternalNetwork(newAdapterData.m_strInternalNetworkName);
-                        fSuccess = comAdapter.isOk();
-                    }
-                    break;
-                }
-                case KNetworkAttachmentType_HostOnly:
-                {
-                    if (fSuccess && newAdapterData.m_strHostInterfaceName != oldAdapterData.m_strHostInterfaceName)
-                    {
-                        comAdapter.SetHostOnlyInterface(newAdapterData.m_strHostInterfaceName);
-                        fSuccess = comAdapter.isOk();
-                    }
-                    break;
-                }
-                case KNetworkAttachmentType_Generic:
-                {
-                    if (fSuccess && newAdapterData.m_strGenericDriverName != oldAdapterData.m_strGenericDriverName)
-                    {
-                        comAdapter.SetGenericDriver(newAdapterData.m_strGenericDriverName);
-                        fSuccess = comAdapter.isOk();
-                    }
-                    if (fSuccess && newAdapterData.m_strGenericProperties != oldAdapterData.m_strGenericProperties)
-                        fSuccess = saveGenericProperties(comAdapter, newAdapterData.m_strGenericProperties);
-                    break;
-                }
-                case KNetworkAttachmentType_NATNetwork:
-                {
-                    if (fSuccess && newAdapterData.m_strNATNetworkName != oldAdapterData.m_strNATNetworkName)
-                    {
-                        comAdapter.SetNATNetwork(newAdapterData.m_strNATNetworkName);
-                        fSuccess = comAdapter.isOk();
-                    }
-                    break;
-                }
-                default:
-                    break;
-            }
-            if (fSuccess && newAdapterData.m_attachmentType != oldAdapterData.m_attachmentType)
-            {
-                comAdapter.SetAttachmentType(newAdapterData.m_attachmentType);
-                fSuccess = comAdapter.isOk();
-            }
-            /* Save adapter promiscuous mode: */
-            if (fSuccess && newAdapterData.m_promiscuousMode != oldAdapterData.m_promiscuousMode)
-            {
-                comAdapter.SetPromiscModePolicy(newAdapterData.m_promiscuousMode);
-                fSuccess = comAdapter.isOk();
-            }
-            /* Save whether the adapter cable connected: */
-            if (fSuccess && newAdapterData.m_fCableConnected != oldAdapterData.m_fCableConnected)
-            {
-                comAdapter.SetCableConnected(newAdapterData.m_fCableConnected);
-                fSuccess = comAdapter.isOk();
-            }
-            /* Save adapter redirect options: */
-            if (   fSuccess && newAdapterData.m_redirects != oldAdapterData.m_redirects
-                && (   oldAdapterData.m_attachmentType == KNetworkAttachmentType_NAT
-                    || newAdapterData.m_attachmentType == KNetworkAttachmentType_NAT))
-            {
-                foreach (const QString &strOldRedirect, comAdapter.GetNATEngine().GetRedirects())
-                    comAdapter.GetNATEngine().RemoveRedirect(strOldRedirect.section(',', 0, 0));
-                foreach (const UIPortForwardingData &newRedirect, newAdapterData.m_redirects)
-                    comAdapter.GetNATEngine().AddRedirect(newRedirect.name, newRedirect.protocol,
-                                                       newRedirect.hostIp, newRedirect.hostPort.value(),
-                                                       newRedirect.guestIp, newRedirect.guestPort.value());
-            }
-            /* Show error message if necessary: */
-            if (!fSuccess)
-                msgCenter().cannotSaveNetworkAdapterSettings(comAdapter, this);
         }
     }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp	(revision 66555)
@@ -586,35 +586,39 @@
             CParallelPort comPort = m_machine.GetParallelPort(iPort);
             fSuccess = m_machine.isOk() && comPort.isNotNull();
+
             /* Show error message if necessary: */
             if (!fSuccess)
                 msgCenter().cannotSaveParallelSettings(m_machine, this);
-
-            /* Save whether the port is enabled: */
-            if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled)
+            else
             {
-                comPort.SetEnabled(newPortData.m_fPortEnabled);
-                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 port path: */
+                if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)
+                {
+                    comPort.SetPath(newPortData.m_strPath);
+                    fSuccess = comPort.isOk();
+                }
+
+                /* Show error message if necessary: */
+                if (!fSuccess)
+                    msgCenter().cannotSaveParallelPortSettings(comPort, this);
             }
-            /* 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 port path: */
-            if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)
-            {
-                comPort.SetPath(newPortData.m_strPath);
-                fSuccess = comPort.isOk();
-            }
-            /* Show error message if necessary: */
-            if (!fSuccess)
-                msgCenter().cannotSaveParallelPortSettings(comPort, this);
         }
     }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp	(revision 66555)
@@ -866,7 +866,9 @@
                 folders = m_machine.GetSharedFolders();
                 fSuccess = m_machine.isOk();
+
                 /* Show error message if necessary: */
                 if (!fSuccess)
                     msgCenter().cannotLoadFoldersSettings(m_machine, this);
+
                 break;
             }
@@ -878,7 +880,9 @@
                 folders = m_console.GetSharedFolders();
                 fSuccess = m_console.isOk();
+
                 /* Show error message if necessary: */
                 if (!fSuccess)
                     msgCenter().cannotLoadFoldersSettings(m_console, this);
+
                 break;
             }
@@ -908,4 +912,5 @@
             fSuccess = comCurrentFolder.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -934,9 +939,9 @@
 
             /* Remove folder marked for 'remove' or 'update': */
-            if (folderCache.wasRemoved() || folderCache.wasUpdated())
+            if (fSuccess && (folderCache.wasRemoved() || folderCache.wasUpdated()))
                 fSuccess = removeSharedFolder(folderCache);
 
             /* Create folder marked for 'create' or 'update': */
-            if (folderCache.wasCreated() || folderCache.wasUpdated())
+            if (fSuccess && (folderCache.wasCreated() || folderCache.wasUpdated()))
                 fSuccess = createSharedFolder(folderCache);
         }
@@ -966,8 +971,8 @@
         CSharedFolder comFolder;
         if (fSuccess)
-            /* fSuccess = */ getSharedFolder(strFolderName, folders, comFolder);
+            fSuccess = getSharedFolder(strFolderName, folders, comFolder);
 
         /* Make sure such folder really exists: */
-        if (!comFolder.isNull())
+        if (fSuccess && !comFolder.isNull())
         {
             /* Remove existing folder: */
@@ -1013,5 +1018,5 @@
     /* Prepare result: */
     bool fSuccess = true;
-    /* Remove folder: */
+    /* Create folder: */
     if (fSuccess)
     {
@@ -1032,8 +1037,8 @@
         CSharedFolder comFolder;
         if (fSuccess)
-            /* fSuccess = */ getSharedFolder(strFolderName, folders, comFolder);
+            fSuccess = getSharedFolder(strFolderName, folders, comFolder);
 
         /* Make sure such folder doesn't exist: */
-        if (comFolder.isNull())
+        if (fSuccess && comFolder.isNull())
         {
             /* Create new folder: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp	(revision 66555)
@@ -643,63 +643,67 @@
             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)
+            else
             {
-                comPort.SetHostMode(newPortData.m_hostMode);
-                fSuccess = comPort.isOk();
+                // 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);
             }
-            /* 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);
         }
     }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp	(revision 66555)
@@ -4012,14 +4012,16 @@
         const UIDataSettingsMachineStorageController &oldControllerData = controllerCache.base();
 
-        /* Make sure controller really exists: */
+        /* Search for a controller with the same name: */
         const CStorageController &comController = m_machine.GetStorageControllerByName(oldControllerData.m_strControllerName);
         fSuccess = m_machine.isOk() && comController.isNotNull();
 
-        /* Remove controller with all the attachments at one shot: */
+        /* Make sure controller really exists: */
         if (fSuccess)
         {
+            /* Remove controller with all the attachments at one shot: */
             m_machine.RemoveStorageController(oldControllerData.m_strControllerName);
             fSuccess = m_machine.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -4040,5 +4042,5 @@
         const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data();
 
-        /* Make sure controller doesn't exist: */
+        /* Search for a controller with the same name: */
         const CMachine comMachine(m_machine);
         CStorageController comController = comMachine.GetStorageControllerByName(newControllerData.m_strControllerName);
@@ -4046,62 +4048,67 @@
         AssertReturn(fSuccess, false);
 
-        /* Create controller: */
+        /* Make sure controller doesn't exist: */
         if (fSuccess)
         {
+            /* Create controller: */
             comController = m_machine.AddStorageController(newControllerData.m_strControllerName, newControllerData.m_controllerBus);
             fSuccess = m_machine.isOk() && comController.isNotNull();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
             msgCenter().cannotSaveStorageSettings(m_machine, this);
-
-        /* Save controller type: */
-        if (fSuccess)
-        {
-            comController.SetControllerType(newControllerData.m_controllerType);
-            fSuccess = comController.isOk();
-        }
-        /* Save whether controller uses host IO cache: */
-        if (fSuccess)
-        {
-            comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache);
-            fSuccess = comController.isOk();
-        }
-        /* Save controller port number: */
-        if (   fSuccess
-            && (   newControllerData.m_controllerBus == KStorageBus_SATA
-                || newControllerData.m_controllerBus == KStorageBus_SAS
-                || newControllerData.m_controllerBus == KStorageBus_PCIe))
-        {
-            ULONG uNewPortCount = newControllerData.m_uPortCount;
+        else
+        {
+            /* Save controller type: */
             if (fSuccess)
             {
-                uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());
+                comController.SetControllerType(newControllerData.m_controllerType);
                 fSuccess = comController.isOk();
             }
+            /* Save whether controller uses host IO cache: */
             if (fSuccess)
             {
-                uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());
+                comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache);
                 fSuccess = comController.isOk();
             }
-            if (fSuccess)
+            /* Save controller port number: */
+            if (   fSuccess
+                && (   newControllerData.m_controllerBus == KStorageBus_SATA
+                    || newControllerData.m_controllerBus == KStorageBus_SAS
+                    || newControllerData.m_controllerBus == KStorageBus_PCIe))
             {
-                comController.SetPortCount(uNewPortCount);
-                fSuccess = comController.isOk();
+                ULONG uNewPortCount = newControllerData.m_uPortCount;
+                if (fSuccess)
+                {
+                    uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());
+                    fSuccess = comController.isOk();
+                }
+                if (fSuccess)
+                {
+                    uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());
+                    fSuccess = comController.isOk();
+                }
+                if (fSuccess)
+                {
+                    comController.SetPortCount(uNewPortCount);
+                    fSuccess = comController.isOk();
+                }
             }
-        }
-        /* Show error message if necessary: */
-        if (!fSuccess)
-            msgCenter().cannotSaveStorageControllerSettings(comController, this);
-
-        /* For each attachment: */
-        for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
-        {
-            /* Get attachment cache: */
-            const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
-
-            /* Create attachment if it was not 'removed': */
-            if (!attachmentCache.wasRemoved())
-                fSuccess = createStorageAttachment(controllerCache, attachmentCache);
+
+            /* Show error message if necessary: */
+            if (!fSuccess)
+                msgCenter().cannotSaveStorageControllerSettings(comController, this);
+
+            /* For each attachment: */
+            for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
+            {
+                /* Get attachment cache: */
+                const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
+
+                /* Create attachment if it was not 'removed': */
+                if (!attachmentCache.wasRemoved())
+                    fSuccess = createStorageAttachment(controllerCache, attachmentCache);
+            }
         }
     }
@@ -4122,79 +4129,83 @@
         const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data();
 
-        /* Make sure controller really exists: */
+        /* Search for a controller with the same name: */
         CStorageController comController = m_machine.GetStorageControllerByName(oldControllerData.m_strControllerName);
         fSuccess = m_machine.isOk() && comController.isNotNull();
+
         /* Show error message if necessary: */
         if (!fSuccess)
             msgCenter().cannotSaveStorageSettings(m_machine, this);
-
-        /* Save controller type: */
-        if (fSuccess && newControllerData.m_controllerType != oldControllerData.m_controllerType)
-        {
-            comController.SetControllerType(newControllerData.m_controllerType);
-            fSuccess = comController.isOk();
-        }
-        /* Save whether controller uses IO cache: */
-        if (fSuccess && newControllerData.m_fUseHostIOCache != oldControllerData.m_fUseHostIOCache)
-        {
-            comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache);
-            fSuccess = comController.isOk();
-        }
-        /* Save controller port number: */
-        if (   fSuccess
-            && newControllerData.m_uPortCount != oldControllerData.m_uPortCount
-            && (   newControllerData.m_controllerBus == KStorageBus_SATA
-                || newControllerData.m_controllerBus == KStorageBus_SAS
-                || newControllerData.m_controllerBus == KStorageBus_PCIe))
-        {
-            ULONG uNewPortCount = newControllerData.m_uPortCount;
-            if (fSuccess)
+        else
+        {
+            /* Save controller type: */
+            if (fSuccess && newControllerData.m_controllerType != oldControllerData.m_controllerType)
             {
-                uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());
+                comController.SetControllerType(newControllerData.m_controllerType);
                 fSuccess = comController.isOk();
             }
-            if (fSuccess)
+            /* Save whether controller uses IO cache: */
+            if (fSuccess && newControllerData.m_fUseHostIOCache != oldControllerData.m_fUseHostIOCache)
             {
-                uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());
+                comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache);
                 fSuccess = comController.isOk();
             }
-            if (fSuccess)
+            /* Save controller port number: */
+            if (   fSuccess
+                && newControllerData.m_uPortCount != oldControllerData.m_uPortCount
+                && (   newControllerData.m_controllerBus == KStorageBus_SATA
+                    || newControllerData.m_controllerBus == KStorageBus_SAS
+                    || newControllerData.m_controllerBus == KStorageBus_PCIe))
             {
-                comController.SetPortCount(uNewPortCount);
-                fSuccess = comController.isOk();
+                ULONG uNewPortCount = newControllerData.m_uPortCount;
+                if (fSuccess)
+                {
+                    uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());
+                    fSuccess = comController.isOk();
+                }
+                if (fSuccess)
+                {
+                    uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());
+                    fSuccess = comController.isOk();
+                }
+                if (fSuccess)
+                {
+                    comController.SetPortCount(uNewPortCount);
+                    fSuccess = comController.isOk();
+                }
             }
-        }
-        /* Show error message if necessary: */
-        if (!fSuccess)
-            msgCenter().cannotSaveStorageControllerSettings(comController, this);
-
-        /* For each attachment ('removing' step): */
-        // We need to separately remove attachments first because
-        // there could be limited amount of attachments available.
-        for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
-        {
-            /* Get attachment cache: */
-            const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
-
-            /* Remove attachment marked for 'remove' or 'update' (if it can't be updated): */
-            if (attachmentCache.wasRemoved() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache)))
-                fSuccess = removeStorageAttachment(controllerCache, attachmentCache);
-        }
-
-        /* For each attachment ('creating' step): */
-        for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
-        {
-            /* Get attachment cache: */
-            const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
-
-            /* Create attachment marked for 'create' or 'update' (if it can't be updated): */
-            if (attachmentCache.wasCreated() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache)))
-                fSuccess = createStorageAttachment(controllerCache, attachmentCache);
-
-            else
-
-            /* Update attachment marked for 'update' (if it can be updated): */
-            if (attachmentCache.wasUpdated() && isAttachmentCouldBeUpdated(attachmentCache))
-                fSuccess = updateStorageAttachment(controllerCache, attachmentCache);
+
+            /* Show error message if necessary: */
+            if (!fSuccess)
+                msgCenter().cannotSaveStorageControllerSettings(comController, this);
+
+            /* For each attachment ('removing' step): */
+            // We need to separately remove attachments first because
+            // there could be limited amount of attachments available.
+            for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
+            {
+                /* Get attachment cache: */
+                const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
+
+                /* Remove attachment marked for 'remove' or 'update' (if it can't be updated): */
+                if (attachmentCache.wasRemoved() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache)))
+                    fSuccess = removeStorageAttachment(controllerCache, attachmentCache);
+            }
+
+            /* For each attachment ('creating' step): */
+            for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)
+            {
+                /* Get attachment cache: */
+                const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex);
+
+                /* Create attachment marked for 'create' or 'update' (if it can't be updated): */
+                if (attachmentCache.wasCreated() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache)))
+                    fSuccess = createStorageAttachment(controllerCache, attachmentCache);
+
+                else
+
+                /* Update attachment marked for 'update' (if it can be updated): */
+                if (attachmentCache.wasUpdated() && isAttachmentCouldBeUpdated(attachmentCache))
+                    fSuccess = updateStorageAttachment(controllerCache, attachmentCache);
+            }
         }
     }
@@ -4216,5 +4227,5 @@
         const UIDataSettingsMachineStorageAttachment &oldAttachmentData = attachmentCache.base();
 
-        /* Make sure attachment really exists: */
+        /* Search for an attachment with the same parameters: */
         const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(oldControllerData.m_strControllerName,
                                                                                oldAttachmentData.m_iAttachmentPort,
@@ -4222,7 +4233,8 @@
         fSuccess = m_machine.isOk() && comAttachment.isNotNull();
 
-        /* Remove attachment: */
+        /* Make sure attachment really exists: */
         if (fSuccess)
         {
+            /* Remove attachment: */
             m_machine.DetachDevice(oldControllerData.m_strControllerName,
                                    oldAttachmentData.m_iAttachmentPort,
@@ -4230,4 +4242,5 @@
             fSuccess = m_machine.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -4251,5 +4264,5 @@
         const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data();
 
-        /* Make sure attachment doesn't exist: */
+        /* Search for an attachment with the same parameters: */
         const CMachine comMachine(m_machine);
         const CMediumAttachment &comAttachment = comMachine.GetMediumAttachment(newControllerData.m_strControllerName,
@@ -4259,7 +4272,8 @@
         AssertReturn(fSuccess, false);
 
-        /* Create attachment: */
+        /* Make sure attachment doesn't exist: */
         if (fSuccess)
         {
+            /* Create attachment: */
             const UIMedium vboxMedium = vboxGlobal().medium(newAttachmentData.m_strAttachmentMediumId);
             const CMedium comMedium = vboxMedium.medium();
@@ -4271,4 +4285,5 @@
             fSuccess = m_machine.isOk();
         }
+
         if (newAttachmentData.m_attachmentType == KDeviceType_DVD)
         {
@@ -4304,4 +4319,5 @@
             }
         }
+
         if (newControllerData.m_controllerBus == KStorageBus_SATA || newControllerData.m_controllerBus == KStorageBus_USB)
         {
@@ -4316,4 +4332,5 @@
             }
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -4337,16 +4354,18 @@
         const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data();
 
-        /* Make sure attachment really exists: */
+        /* Search for an attachment with the same parameters: */
         const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(newControllerData.m_strControllerName,
                                                                                newAttachmentData.m_iAttachmentPort,
                                                                                newAttachmentData.m_iAttachmentDevice);
         fSuccess = m_machine.isOk() && comAttachment.isNotNull();
+
         /* Show error message if necessary: */
         if (!fSuccess)
             msgCenter().cannotSaveStorageSettings(m_machine, this);
 
-        /* Remount attachment: */
+        /* Make sure attachment doesn't exist: */
         if (fSuccess)
         {
+            /* Remount attachment: */
             const UIMedium vboxMedium = vboxGlobal().medium(newAttachmentData.m_strAttachmentMediumId);
             const CMedium comMedium = vboxMedium.medium();
@@ -4358,4 +4377,5 @@
             fSuccess = m_machine.isOk();
         }
+
         if (newAttachmentData.m_attachmentType == KDeviceType_DVD)
         {
@@ -4391,4 +4411,5 @@
             }
         }
+
         if (newControllerData.m_controllerBus == KStorageBus_SATA || newControllerData.m_controllerBus == KStorageBus_USB)
         {
@@ -4403,4 +4424,5 @@
             }
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp	(revision 66555)
@@ -1136,4 +1136,5 @@
             }
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -1174,4 +1175,5 @@
             fSuccess = m_machine.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -1212,4 +1214,5 @@
             fSuccess = m_machine.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp	(revision 66554)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp	(revision 66555)
@@ -1012,18 +1012,19 @@
             CUSBDeviceFilters comFiltersObject = m_machine.GetUSBDeviceFilters();
             fSuccess = m_machine.isOk() && comFiltersObject.isNotNull();
+
             /* Show error message if necessary: */
             if (!fSuccess)
                 msgCenter().cannotSaveUSBSettings(m_machine, this);
-
-            /* For each filter data set: */
-            int iOperationPosition = 0;
-            for (int iFilterIndex = 0; fSuccess && iFilterIndex < m_pCache->childCount(); ++iFilterIndex)
-            {
-                /* Check if USB filter data was changed: */
-                const UISettingsCacheMachineUSBFilter &filterCache = m_pCache->child(iFilterIndex);
-                if (filterCache.wasChanged())
+            else
+            {
+                /* For each filter data set: */
+                int iOperationPosition = 0;
+                for (int iFilterIndex = 0; fSuccess && iFilterIndex < m_pCache->childCount(); ++iFilterIndex)
                 {
+                    /* Check if USB filter data was changed: */
+                    const UISettingsCacheMachineUSBFilter &filterCache = m_pCache->child(iFilterIndex);
+
                     /* Remove filter marked for 'remove' or 'update': */
-                    if (filterCache.wasRemoved() || filterCache.wasUpdated())
+                    if (fSuccess && (filterCache.wasRemoved() || filterCache.wasUpdated()))
                     {
                         fSuccess = removeUSBFilter(comFiltersObject, iOperationPosition);
@@ -1033,9 +1034,10 @@
 
                     /* Create filter marked for 'create' or 'update': */
-                    if (filterCache.wasCreated() || filterCache.wasUpdated())
+                    if (fSuccess && (filterCache.wasCreated() || filterCache.wasUpdated()))
                         fSuccess = createUSBFilter(comFiltersObject, iOperationPosition, filterCache.data());
+
+                    /* Advance operation position: */
+                    ++iOperationPosition;
                 }
-                /* Advance operation position: */
-                ++iOperationPosition;
             }
         }
@@ -1055,4 +1057,5 @@
         const CUSBControllerVector &controllers = m_machine.GetUSBControllers();
         fSuccess = m_machine.isOk();
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -1079,21 +1082,25 @@
                 fSuccess = comController.isOk();
             }
+
             /* Show error message if necessary: */
             if (!fSuccess)
                 msgCenter().cannotSaveUSBControllerSettings(comController, this);
-
-            /* Pass only if requested types were not defined or contains the one we found: */
-            if (!types.isEmpty() && !types.contains(enmType))
-                continue;
-
-            /* Remove controller: */
-            if (fSuccess)
-            {
-                m_machine.RemoveUSBController(comController.GetName());
-                fSuccess = m_machine.isOk();
-            }
-            /* Show error message if necessary: */
-            if (!fSuccess)
-                msgCenter().cannotSaveUSBSettings(m_machine, this);
+            else
+            {
+                /* Pass only if requested types were not defined or contains the one we found: */
+                if (!types.isEmpty() && !types.contains(enmType))
+                    continue;
+
+                /* Remove controller: */
+                if (fSuccess)
+                {
+                    m_machine.RemoveUSBController(comController.GetName());
+                    fSuccess = m_machine.isOk();
+                }
+
+                /* Show error message if necessary: */
+                if (!fSuccess)
+                    msgCenter().cannotSaveUSBSettings(m_machine, this);
+            }
         }
     }
@@ -1128,77 +1135,86 @@
             fSuccess = m_machine.isOk();
         }
+
         /* Show error message if necessary: */
         if (!fSuccess)
             msgCenter().cannotSaveUSBSettings(m_machine, this);
-
-        /* For requested controller type: */
-        switch (enmType)
-        {
-            case KUSBControllerType_OHCI:
-            {
-                /* Remove excessive controllers: */
-                if (cXhciCtls || cEhciCtls)
-                    fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
-                                                    << KUSBControllerType_XHCI
-                                                    << KUSBControllerType_EHCI);
-
-                /* Add required controller: */
-                if (fSuccess && !cOhciCtls)
+        else
+        {
+            /* For requested controller type: */
+            switch (enmType)
+            {
+                case KUSBControllerType_OHCI:
                 {
-                    m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
-                    fSuccess = m_machine.isOk();
+                    /* Remove excessive controllers: */
+                    if (cXhciCtls || cEhciCtls)
+                        fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
+                                                        << KUSBControllerType_XHCI
+                                                        << KUSBControllerType_EHCI);
+
+                    /* Add required controller: */
+                    if (fSuccess && !cOhciCtls)
+                    {
+                        m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
+                        fSuccess = m_machine.isOk();
+
+                        /* Show error message if necessary: */
+                        if (!fSuccess)
+                            msgCenter().cannotSaveUSBSettings(m_machine, this);
+                    }
+
+                    break;
                 }
-                /* Show error message if necessary: */
-                if (!fSuccess)
-                    msgCenter().cannotSaveUSBSettings(m_machine, this);
-
-                break;
-            }
-            case KUSBControllerType_EHCI:
-            {
-                /* Remove excessive controllers: */
-                if (cXhciCtls)
-                    fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
-                                                    << KUSBControllerType_XHCI);
-
-                /* Add required controllers: */
-                if (fSuccess && !cOhciCtls)
+                case KUSBControllerType_EHCI:
                 {
-                    m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
-                    fSuccess = m_machine.isOk();
+                    /* Remove excessive controllers: */
+                    if (cXhciCtls)
+                        fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
+                                                        << KUSBControllerType_XHCI);
+
+                    /* Add required controllers: */
+                    if (fSuccess)
+                    {
+                        if (fSuccess && !cOhciCtls)
+                        {
+                            m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
+                            fSuccess = m_machine.isOk();
+                        }
+                        if (fSuccess && !cEhciCtls)
+                        {
+                            m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI);
+                            fSuccess = m_machine.isOk();
+                        }
+
+                        /* Show error message if necessary: */
+                        if (!fSuccess)
+                            msgCenter().cannotSaveUSBSettings(m_machine, this);
+                    }
+
+                    break;
                 }
-                if (fSuccess && !cEhciCtls)
+                case KUSBControllerType_XHCI:
                 {
-                    m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI);
-                    fSuccess = m_machine.isOk();
+                    /* Remove excessive controllers: */
+                    if (cEhciCtls || cOhciCtls)
+                        fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
+                                                        << KUSBControllerType_EHCI
+                                                        << KUSBControllerType_OHCI);
+
+                    /* Add required controller: */
+                    if (fSuccess && !cXhciCtls)
+                    {
+                        m_machine.AddUSBController("xHCI", KUSBControllerType_XHCI);
+                        fSuccess = m_machine.isOk();
+
+                        /* Show error message if necessary: */
+                        if (!fSuccess)
+                            msgCenter().cannotSaveUSBSettings(m_machine, this);
+                    }
+
+                    break;
                 }
-                /* Show error message if necessary: */
-                if (!fSuccess)
-                    msgCenter().cannotSaveUSBSettings(m_machine, this);
-
-                break;
-            }
-            case KUSBControllerType_XHCI:
-            {
-                /* Remove excessive controllers: */
-                if (cEhciCtls || cOhciCtls)
-                    fSuccess = removeUSBControllers(QSet<KUSBControllerType>()
-                                                    << KUSBControllerType_EHCI
-                                                    << KUSBControllerType_OHCI);
-
-                /* Add required controller: */
-                if (fSuccess && !cXhciCtls)
-                {
-                    m_machine.AddUSBController("xHCI", KUSBControllerType_XHCI);
-                    fSuccess = m_machine.isOk();
-                }
-                /* Show error message if necessary: */
-                if (!fSuccess)
-                    msgCenter().cannotSaveUSBSettings(m_machine, this);
-
-                break;
-            }
-            default:
-                break;
+                default:
+                    break;
+            }
         }
     }
@@ -1217,4 +1233,5 @@
         comFiltersObject.RemoveDeviceFilter(iPosition);
         fSuccess = comFiltersObject.isOk();
+
         /* Show error message if necessary: */
         if (!fSuccess)
@@ -1235,75 +1252,79 @@
         CUSBDeviceFilter comFilter = comFiltersObject.CreateDeviceFilter(filterData.m_strName);
         fSuccess = comFiltersObject.isOk() && comFilter.isNotNull();
+
         /* Show error message if necessary: */
         if (!fSuccess)
             msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this);
-
-        /* Save whether filter is active: */
-        if (fSuccess)
-        {
-            comFilter.SetActive(filterData.m_fActive);
-            fSuccess = comFilter.isOk();
-        }
-        /* Save filter Vendor ID: */
-        if (fSuccess)
-        {
-            comFilter.SetVendorId(filterData.m_strVendorId);
-            fSuccess = comFilter.isOk();
-        }
-        /* Save filter Product ID: */
-        if (fSuccess)
-        {
-            comFilter.SetProductId(filterData.m_strProductId);
-            fSuccess = comFilter.isOk();
-        }
-        /* Save filter revision: */
-        if (fSuccess)
-        {
-            comFilter.SetRevision(filterData.m_strRevision);
-            fSuccess = comFilter.isOk();
-        }
-        /* Save filter manufacturer: */
-        if (fSuccess)
-        {
-            comFilter.SetManufacturer(filterData.m_strManufacturer);
-            fSuccess = comFilter.isOk();
-        }
-        /* Save filter product: */
-        if (fSuccess)
-        {
-            comFilter.SetProduct(filterData.m_strProduct);
-            fSuccess = comFilter.isOk();
-        }
-        /* Save filter serial number: */
-        if (fSuccess)
-        {
-            comFilter.SetSerialNumber(filterData.m_strSerialNumber);
-            fSuccess = comFilter.isOk();
-        }
-        /* Save filter port: */
-        if (fSuccess)
-        {
-            comFilter.SetPort(filterData.m_strPort);
-            fSuccess = comFilter.isOk();
-        }
-        /* Save filter remote mode: */
-        if (fSuccess)
-        {
-            comFilter.SetRemote(filterData.m_strRemote);
-            fSuccess = comFilter.isOk();
-        }
-        /* Show error message if necessary: */
-        if (!fSuccess)
-            msgCenter().cannotSaveUSBDeviceFilterSettings(comFilter, this);
-
-        /* Insert filter onto corresponding position: */
-        if (fSuccess)
-        {
-            comFiltersObject.InsertDeviceFilter(iPosition, comFilter);
-            fSuccess = comFiltersObject.isOk();
-        }
-        /* Show error message if necessary: */
-        if (!fSuccess)
-            msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this);
+        else
+        {
+            /* Save whether filter is active: */
+            if (fSuccess)
+            {
+                comFilter.SetActive(filterData.m_fActive);
+                fSuccess = comFilter.isOk();
+            }
+            /* Save filter Vendor ID: */
+            if (fSuccess)
+            {
+                comFilter.SetVendorId(filterData.m_strVendorId);
+                fSuccess = comFilter.isOk();
+            }
+            /* Save filter Product ID: */
+            if (fSuccess)
+            {
+                comFilter.SetProductId(filterData.m_strProductId);
+                fSuccess = comFilter.isOk();
+            }
+            /* Save filter revision: */
+            if (fSuccess)
+            {
+                comFilter.SetRevision(filterData.m_strRevision);
+                fSuccess = comFilter.isOk();
+            }
+            /* Save filter manufacturer: */
+            if (fSuccess)
+            {
+                comFilter.SetManufacturer(filterData.m_strManufacturer);
+                fSuccess = comFilter.isOk();
+            }
+            /* Save filter product: */
+            if (fSuccess)
+            {
+                comFilter.SetProduct(filterData.m_strProduct);
+                fSuccess = comFilter.isOk();
+            }
+            /* Save filter serial number: */
+            if (fSuccess)
+            {
+                comFilter.SetSerialNumber(filterData.m_strSerialNumber);
+                fSuccess = comFilter.isOk();
+            }
+            /* Save filter port: */
+            if (fSuccess)
+            {
+                comFilter.SetPort(filterData.m_strPort);
+                fSuccess = comFilter.isOk();
+            }
+            /* Save filter remote mode: */
+            if (fSuccess)
+            {
+                comFilter.SetRemote(filterData.m_strRemote);
+                fSuccess = comFilter.isOk();
+            }
+
+            /* Show error message if necessary: */
+            if (!fSuccess)
+                msgCenter().cannotSaveUSBDeviceFilterSettings(comFilter, this);
+            else
+            {
+                /* Insert filter onto corresponding position: */
+                comFiltersObject.InsertDeviceFilter(iPosition, comFilter);
+                fSuccess = comFiltersObject.isOk();
+
+                /* Show error message if necessary: */
+                if (!fSuccess)
+                    msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this);
+            }
+        }
     }
     /* Return result: */
