Index: /trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp	(revision 83682)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp	(revision 83683)
@@ -46,4 +46,5 @@
 #include "UIVirtualBoxManagerWidget.h"
 #include "UIVirtualMachineItemCloud.h"
+#include "UIVirtualMachineItemLocal.h"
 #include "UIWizardAddCloudVM.h"
 #include "UIWizardNewVM.h"
@@ -1123,5 +1124,5 @@
     QMap<QUuid, bool> verdicts;
     QList<UIChooserItem*> itemsToRemove;
-    QList<QUuid> machinesToUnregister;
+    QList<CMachine> localMachinesToUnregister;
 
     /* For each selected machine-item: */
@@ -1129,5 +1130,5 @@
     {
         /* Get machine-item id: */
-        QUuid uId = pItem->toMachineItem()->id();
+        const QUuid uId = pItem->toMachineItem()->id();
 
         /* We already decided for that machine? */
@@ -1135,5 +1136,5 @@
         {
             /* To remove similar machine items? */
-            if (!verdicts[uId])
+            if (!verdicts.value(uId))
                 itemsToRemove << pItem;
             continue;
@@ -1153,8 +1154,8 @@
          * we will propose ro unregister machine fully else
          * we will just propose to remove selected-items: */
-        bool fVerdict = iSelectedCopyCount == iExistingCopyCount;
+        const bool fVerdict = iSelectedCopyCount == iExistingCopyCount;
         verdicts.insert(uId, fVerdict);
         if (fVerdict)
-            machinesToUnregister.append(uId);
+            localMachinesToUnregister.append(pItem->node()->toMachineNode()->cache()->toLocal()->machine());
         else
             itemsToRemove << pItem;
@@ -1164,7 +1165,7 @@
     if (!itemsToRemove.isEmpty())
         removeItems(itemsToRemove);
-    /* If we have something to unregister: */
-    if (!machinesToUnregister.isEmpty())
-        unregisterMachines(machinesToUnregister);
+    /* If we have something local to unregister: */
+    if (!localMachinesToUnregister.isEmpty())
+        unregisterMachines(localMachinesToUnregister);
 }
 
@@ -1633,16 +1634,6 @@
 }
 
-void UIChooserModel::unregisterMachines(const QList<QUuid> &ids)
-{
-    /* Populate machine list: */
-    QList<CMachine> machines;
-    CVirtualBox vbox = uiCommon().virtualBox();
-    foreach (const QUuid &uId, ids)
-    {
-        CMachine machine = vbox.FindMachine(uId.toString());
-        if (!machine.isNull())
-            machines << machine;
-    }
-
+void UIChooserModel::unregisterMachines(const QList<CMachine> &machines)
+{
     /* Confirm machine removal: */
     int iResultCode = msgCenter().confirmMachineRemoval(machines);
@@ -1653,30 +1644,28 @@
     setSelectedItem(findClosestUnselectedItem());
 
-    /* For every selected-item: */
-    for (int iMachineIndex = 0; iMachineIndex < machines.size(); ++iMachineIndex)
-    {
-        /* Get iterated machine: */
-        CMachine &machine = machines[iMachineIndex];
+    /* For every selected machine: */
+    foreach (CMachine comMachine, machines)
+    {
         if (iResultCode == AlertButton_Choice1)
         {
             /* Unregister machine first: */
-            CMediumVector media = machine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
-            if (!machine.isOk())
+            CMediumVector comMedia = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
+            if (!comMachine.isOk())
             {
-                msgCenter().cannotRemoveMachine(machine);
+                msgCenter().cannotRemoveMachine(comMachine);
                 continue;
             }
             /* Prepare cleanup progress: */
-            CProgress progress = machine.DeleteConfig(media);
-            if (!machine.isOk())
+            CProgress comProgress = comMachine.DeleteConfig(comMedia);
+            if (!comMachine.isOk())
             {
-                msgCenter().cannotRemoveMachine(machine);
+                msgCenter().cannotRemoveMachine(comMachine);
                 continue;
             }
             /* And show cleanup progress finally: */
-            msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_delete_90px.png");
-            if (!progress.isOk() || progress.GetResultCode() != 0)
+            msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_delete_90px.png");
+            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
             {
-                msgCenter().cannotRemoveMachine(machine, progress);
+                msgCenter().cannotRemoveMachine(comMachine, comProgress);
                 continue;
             }
@@ -1685,15 +1674,15 @@
         {
             /* Unregister machine first: */
-            CMediumVector media = machine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
-            if (!machine.isOk())
+            CMediumVector comMedia = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
+            if (!comMachine.isOk())
             {
-                msgCenter().cannotRemoveMachine(machine);
+                msgCenter().cannotRemoveMachine(comMachine);
                 continue;
             }
             /* Finally close all media, deliberately ignoring errors: */
-            foreach (CMedium medium, media)
+            foreach (CMedium comMedium, comMedia)
             {
-                if (!medium.isNull())
-                    medium.Close();
+                if (!comMedium.isNull())
+                    comMedium.Close();
             }
         }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h	(revision 83682)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h	(revision 83683)
@@ -28,4 +28,8 @@
 #include "UIChooserAbstractModel.h"
 #include "UIExtraDataDefs.h"
+
+/* COM includes: */
+#include "COMEnums.h"
+#include "CMachine.h"
 
 /* Forward declaration: */
@@ -359,6 +363,6 @@
         /** Removes machine @a items. */
         void removeItems(const QList<UIChooserItem*> &items);
-        /** Unregisters virtual machines using list of @a ids. */
-        void unregisterMachines(const QList<QUuid> &ids);
+        /** Unregisters a list of virtual @a machines. */
+        void unregisterMachines(const QList<CMachine> &machines);
 
         /** Processes drag move @a pEvent. */
