Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp	(revision 41041)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp	(revision 41042)
@@ -74,4 +74,15 @@
     Q_OBJECT;
 
+signals:
+
+    /* Signal to notify main GUI thread about process has been started: */
+    void sigNotifyAboutProcessStarted();
+
+    /* Signal to notify main GUI thread about some page was processed: */
+    void sigNotifyAboutPageProcessed(int iPageId);
+
+    /* Signal to notify main GUI thread about all pages were processed: */
+    void sigNotifyAboutPagesProcessed();
+
 public:
 
@@ -84,9 +95,11 @@
         , m_direction(direction)
         , m_data(data)
-        , m_fConditionDone(false)
-        , m_fAllowToDestroySerializer(false)
-        , m_iPageIdWeAreWaitingFor(-1)
+        , m_fSavingComplete(m_direction == UISettingsSerializeDirection_Load)
+        , m_fAllowToDestroySerializer(m_direction == UISettingsSerializeDirection_Load)
         , m_iIdOfHighPriorityPage(-1)
     {
+        /* Set instance: */
+        m_pInstance = this;
+
         /* Connecting this signals: */
         connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), this, SLOT(sltHandleProcessedPage(int)), Qt::QueuedConnection);
@@ -96,7 +109,4 @@
         connect(this, SIGNAL(sigNotifyAboutProcessStarted()), parent(), SLOT(sltHandleProcessStarted()), Qt::QueuedConnection);
         connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), parent(), SLOT(sltHandlePageProcessed()), Qt::QueuedConnection);
-
-        /* Set instance: */
-        m_pInstance = this;
     }
 
@@ -104,7 +114,4 @@
     ~UISettingsSerializer()
     {
-        /* Reset instance: */
-        m_pInstance = 0;
-
         /* If serializer is being destructed by it's parent,
          * thread could still be running, we have to wait
@@ -112,4 +119,7 @@
         if (isRunning())
             wait();
+
+        /* Clear instance: */
+        m_pInstance = 0;
     }
 
@@ -124,18 +134,4 @@
     }
 
-    /* Blocks calling thread until requested page will be processed: */
-    void waitForPageToBeProcessed(int iPageId)
-    {
-        m_iPageIdWeAreWaitingFor = iPageId;
-        blockGUIthread();
-    }
-
-    /* Blocks calling thread until all pages will be processed: */
-    void waitForPagesToBeProcessed()
-    {
-        m_iPageIdWeAreWaitingFor = -1;
-        blockGUIthread();
-    }
-
     /* Raise priority of page: */
     void raisePriorityOfPage(int iPageId)
@@ -157,21 +153,11 @@
     QVariant& data() { return m_data; }
 
-signals:
-
-    /* Signal to notify main GUI thread about process has been started: */
-    void sigNotifyAboutProcessStarted();
-
-    /* Signal to notify main GUI thread about some page was processed: */
-    void sigNotifyAboutPageProcessed(int iPageId);
-
-    /* Signal to notify main GUI thread about all pages were processed: */
-    void sigNotifyAboutPagesProcessed();
-
 public slots:
 
     void start(Priority priority = InheritPriority)
     {
-        /* Notify listeners a bout we are starting: */
+        /* Notify listeners about we are starting: */
         emit sigNotifyAboutProcessStarted();
+
         /* If serializer saves settings: */
         if (m_direction == UISettingsSerializeDirection_Save)
@@ -181,6 +167,26 @@
                 m_pages.values()[iPageIndex]->putToCache();
         }
-        /* Start async thread: */
+
+        /* Start async serializing thread: */
         QThread::start(priority);
+
+        /* If serializer saves settings: */
+        if (m_direction == UISettingsSerializeDirection_Save)
+        {
+            /* We should block calling thread until all pages will be saved: */
+            while (!m_fSavingComplete)
+            {
+                /* Lock mutex initially: */
+                m_mutex.lock();
+                /* Perform idle-processing every 100ms,
+                 * and waiting for direct wake up signal: */
+                m_condition.wait(&m_mutex, 100);
+                /* Process queued signals posted to GUI thread: */
+                qApp->processEvents();
+                /* Unlock mutex finally: */
+                m_mutex.unlock();
+            }
+            m_fAllowToDestroySerializer = true;
+        }
     }
 
@@ -197,16 +203,16 @@
                 m_pages[iPageId]->getFromCache();
         }
-        /* If thats the page we are waiting for,
-         * we should flag GUI thread to unlock itself: */
-        if (iPageId == m_iPageIdWeAreWaitingFor && !m_fConditionDone)
-            m_fConditionDone = true;
-    }
-
-    /* Slot to handle the fact of some page was processed: */
+    }
+
+    /* Slot to handle the fact of all pages were processed: */
     void sltHandleProcessedPages()
     {
-        /* We should flag GUI thread to unlock itself: */
-        if (!m_fConditionDone)
-            m_fConditionDone = true;
+        /* If serializer saves settings: */
+        if (m_direction == UISettingsSerializeDirection_Save)
+        {
+            /* We should flag GUI thread to unlock itself: */
+            if (!m_fSavingComplete)
+                m_fSavingComplete = true;
+        }
     }
 
@@ -223,23 +229,4 @@
 
 protected:
-
-    /* GUI thread locker: */
-    void blockGUIthread()
-    {
-        m_fConditionDone = false;
-        while (!m_fConditionDone)
-        {
-            /* Lock mutex initially: */
-            m_mutex.lock();
-            /* Perform idle-processing every 100ms,
-             * and waiting for direct wake up signal: */
-            m_condition.wait(&m_mutex, 100);
-            /* Process queued signals posted to GUI thread: */
-            qApp->processEvents();
-            /* Unlock mutex finally: */
-            m_mutex.unlock();
-        }
-        m_fAllowToDestroySerializer = true;
-    }
 
     /* Settings processor: */
@@ -275,8 +262,8 @@
             /* Notify listeners about page was processed: */
             emit sigNotifyAboutPageProcessed(pPage->id());
-            /* Try to wake up GUI thread, but
-             * it can be busy idle-processing for loaded pages: */
-            if (!m_fConditionDone)
+            /* If serializer saves settings => wake up GUI thread: */
+            if (m_direction == UISettingsSerializeDirection_Save)
                 m_condition.wakeAll();
+            /* Break further processing if page had failed: */
             if (pPage->failed())
                 break;
@@ -284,7 +271,6 @@
         /* Notify listeners about all pages were processed: */
         emit sigNotifyAboutPagesProcessed();
-        /* Try to wake up GUI thread, but
-         * it can be busy idle-processing loaded pages: */
-        if (!m_fConditionDone)
+        /* If serializer saves settings => wake up GUI thread: */
+        if (m_direction == UISettingsSerializeDirection_Save)
             m_condition.wakeAll();
     }
@@ -294,7 +280,6 @@
     QVariant m_data;
     UISettingsPageMap m_pages;
-    bool m_fConditionDone;
+    bool m_fSavingComplete;
     bool m_fAllowToDestroySerializer;
-    int m_iPageIdWeAreWaitingFor;
     int m_iIdOfHighPriorityPage;
     QMutex m_mutex;
@@ -421,4 +406,11 @@
     /* Choose first item by default: */
     m_pSelector->selectById(0);
+}
+
+UISettingsDialogGlobal::~UISettingsDialogGlobal()
+{
+    /* Delete serializer early if exists: */
+    if (UISettingsSerializer::instance())
+        delete UISettingsSerializer::instance();
 }
 
@@ -439,6 +431,4 @@
     /* Start loader: */
     pGlobalSettingsLoader->start();
-    /* Wait for just one (first) page to be loaded: */
-    pGlobalSettingsLoader->waitForPageToBeProcessed(m_pSelector->currentId());
 }
 
@@ -461,6 +451,4 @@
     /* Start saver: */
     pGlobalSettingsSaver->start();
-    /* Wait for all pages to be saved: */
-    pGlobalSettingsSaver->waitForPagesToBeProcessed();
 
     /* Get updated properties & settings: */
@@ -737,4 +725,11 @@
 }
 
+UISettingsDialogMachine::~UISettingsDialogMachine()
+{
+    /* Delete serializer early if exists: */
+    if (UISettingsSerializer::instance())
+        delete UISettingsSerializer::instance();
+}
+
 void UISettingsDialogMachine::loadData()
 {
@@ -774,6 +769,4 @@
     /* Start page loader: */
     pMachineSettingsLoader->start();
-    /* Wait for just one (required) page to be loaded: */
-    pMachineSettingsLoader->waitForPageToBeProcessed(m_pSelector->currentId());
 }
 
@@ -812,6 +805,4 @@
     /* Start saver: */
     pMachineSettingsSaver->start();
-    /* Wait for all pages to be saved: */
-    pMachineSettingsSaver->waitForPagesToBeProcessed();
 
     /* Get updated machine: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h	(revision 41041)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h	(revision 41042)
@@ -46,4 +46,5 @@
 
     UISettingsDialogGlobal(QWidget *pParent);
+    ~UISettingsDialogGlobal();
 
 protected:
@@ -86,4 +87,5 @@
     UISettingsDialogMachine(QWidget *pParent, const QString &strMachineId,
                             const QString &strCategory, const QString &strControl);
+    ~UISettingsDialogMachine();
 
 protected:
