Index: /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp	(revision 79635)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp	(revision 79636)
@@ -1039,8 +1039,8 @@
     m_pEditorLayout->addWidget(m_pGoBackButton, 0, 0, 1, 1);
     connect(m_pGoBackButton, &QToolButton::clicked, this, &UILayoutEditor::sigGoBackButton);
-    pTitleLayout->addWidget(m_pGoBackButton);
-    pTitleLayout->addStretch(2);
     m_pTitleLabel = new QLabel;
     pTitleLayout->addWidget(m_pTitleLabel);
+    pTitleLayout->addStretch(2);
+    pTitleLayout->addWidget(m_pGoBackButton);
     m_pEditorLayout->addLayout(pTitleLayout, 0, 0, 1, 2);
 
@@ -1285,8 +1285,8 @@
     m_pCloseButton->setAutoRaise(true);
     connect(m_pCloseButton, &QToolButton::clicked, this, &UILayoutSelector::sigCloseLayoutList);
-    pTitleLayout->addWidget(m_pCloseButton);
-    pTitleLayout->addStretch(2);
     m_pTitleLabel = new QLabel;
     pTitleLayout->addWidget(m_pTitleLabel);
+    pTitleLayout->addStretch(2);
+    pTitleLayout->addWidget(m_pCloseButton);
     pLayout->addLayout(pTitleLayout);
 
@@ -2630,4 +2630,16 @@
     /* If no pyhsical layout with the UUID the keyboard layout refers is found then cancel loading the keyboard layout: */
     if (!pPhysicalLayout)
+    {
+        m_layouts.removeLast();
+        return false;
+    }
+    /* Make sure we have unique layout UUIDs: */
+    int iCount = 0;
+    foreach (const UISoftKeyboardLayout &layout, m_layouts)
+    {
+        if (layout.uid() == newLayout.uid())
+            ++iCount;
+    }
+    if (iCount > 1)
     {
         m_layouts.removeLast();
@@ -3118,4 +3130,7 @@
     setLayout(pLayout);
 
+    m_pMessageLabel = new QLabel;
+    pLayout->addWidget(m_pMessageLabel);
+
     m_pLayoutListButton = new QToolButton;
     if (m_pLayoutListButton)
@@ -3142,6 +3157,4 @@
     }
 
-    m_pMessageLabel = new QLabel;
-    pLayout->addWidget(m_pMessageLabel);
     retranslateUi();
 }
@@ -3243,8 +3256,8 @@
     m_pCloseButton->setAutoRaise(true);
     connect(m_pCloseButton, &QToolButton::clicked, this, &UISoftKeyboardSettingsWidget::sigCloseSettingsWidget);
-    pTitleLayout->addWidget(m_pCloseButton);
-    pTitleLayout->addStretch(2);
     m_pTitleLabel = new QLabel;
     pTitleLayout->addWidget(m_pTitleLabel);
+    pTitleLayout->addStretch(2);
+    pTitleLayout->addWidget(m_pCloseButton);
     pSettingsLayout->addLayout(pTitleLayout, 0, 0, 1, 2);
 
