Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp	(revision 43594)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp	(revision 43595)
@@ -1367,6 +1367,6 @@
         if (pItem->type() == UIGChooserItemType_Machine)
         {
-            if (UIGChooserItemMachine *pMachineItem = pItem->toMachineItem())
-                return pMachineItem;
+            /* Just return it: */
+            return pItem->toMachineItem();
         }
         /* If that is group-item: */
@@ -1433,26 +1433,27 @@
 {
     /* Search among all the group-items of passed parent: */
-    foreach (UIGChooserItem *pGroupItem, pParent->items(UIGChooserItemType_Group))
-        if (pGroupItem->name() == strName)
+    foreach (UIGChooserItem *pItem, pParent->items(UIGChooserItemType_Group))
+        if (pItem->name() == strName)
+            return pItem;
+    /* Recursively iterate into each the group-item of the passed parent: */
+    foreach (UIGChooserItem *pItem, pParent->items(UIGChooserItemType_Group))
+        if (UIGChooserItem *pGroupItem = findGroupItem(strName, pItem))
             return pGroupItem;
-    /* Recursively iterate into each the group-item of the passed parent: */
-    foreach (UIGChooserItem *pGroupItem, pParent->items(UIGChooserItemType_Group))
-        if (UIGChooserItem *pSubGroupItem = findGroupItem(strName, pGroupItem))
-            return pSubGroupItem;
     /* Nothing found? */
     return 0;
 }
 
-void UIGChooserModel::cleanupGroupTree(UIGChooserItem *pGroupItem)
-{
-    /* Cleanup all the group-items first: */
-    foreach (UIGChooserItem *pSubGroupItem, pGroupItem->items(UIGChooserItemType_Group))
-        cleanupGroupTree(pSubGroupItem);
-    if (!pGroupItem->hasItems())
-    {
-        /* Cleanup only non-root items: */
-        if (!pGroupItem->isRoot())
-            delete pGroupItem;
-        /* Unindent root-items: */
+void UIGChooserModel::cleanupGroupTree(UIGChooserItem *pParent)
+{
+    /* Cleanup all the group-items recursively first: */
+    foreach (UIGChooserItem *pItem, pParent->items(UIGChooserItemType_Group))
+        cleanupGroupTree(pItem);
+    /* If parent has no items: */
+    if (!pParent->hasItems())
+    {
+        /* Cleanup if that is non-root item: */
+        if (!pParent->isRoot())
+            delete pParent;
+        /* Unindent if that is root item: */
         else if (root() != mainRoot())
             unindentRoot();
@@ -1463,25 +1464,21 @@
 {
     /* Search among all the machine-items of passed parent: */
-    foreach (UIGChooserItem *pMachineItem, pParent->items(UIGChooserItemType_Machine))
-        if (pMachineItem->name() == strName)
+    foreach (UIGChooserItem *pItem, pParent->items(UIGChooserItemType_Machine))
+        if (pItem->name() == strName)
+            return pItem;
+    /* Recursively iterate into each the group-item of the passed parent: */
+    foreach (UIGChooserItem *pItem, pParent->items(UIGChooserItemType_Group))
+        if (UIGChooserItem *pMachineItem = findMachineItem(strName, pItem))
             return pMachineItem;
-    /* Recursively iterate into each the group-item of the passed parent: */
-    foreach (UIGChooserItem *pGroupItem, pParent->items(UIGChooserItemType_Group))
-        if (UIGChooserItem *pSubMachineItem = findMachineItem(strName, pGroupItem))
-            return pSubMachineItem;
     /* Nothing found? */
     return 0;
 }
 
-void UIGChooserModel::sortItems(UIGChooserItem *pParent, bool fRecursively /* = false */)
+void UIGChooserModel::sortItems(UIGChooserItem *pParent)
 {
     /* Sort group-items: */
     QMap<QString, UIGChooserItem*> sorter;
     foreach (UIGChooserItem *pItem, pParent->items(UIGChooserItemType_Group))
-    {
         sorter.insert(pItem->name().toLower(), pItem);
-        if (fRecursively)
-            sortItems(pItem, fRecursively);
-    }
     pParent->setItems(sorter.values(), UIGChooserItemType_Group);
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h	(revision 43594)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h	(revision 43595)
@@ -253,5 +253,5 @@
     /* Helpers: Machine-item stuff: */
     UIGChooserItem* findMachineItem(const QString &strName, UIGChooserItem *pParent);
-    void sortItems(UIGChooserItem *pParent, bool fRecursively = false);
+    void sortItems(UIGChooserItem *pParent);
     void updateMachineItems(const QString &strId, UIGChooserItem *pParent);
     void removeMachineItems(const QString &strId, UIGChooserItem *pParent);
