Index: trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/main.cpp	(revision 72362)
+++ trunk/src/VBox/Frontends/VirtualBox/src/main.cpp	(revision 72363)
@@ -481,10 +481,14 @@
                 break;
 
-            /* For Runtime UI: */
-            if (vboxGlobal().isVMConsoleProcess())
-            {
-                /* Prevent application from exiting when all window(s) closed: */
-                qApp->setQuitOnLastWindowClosed(false);
-            }
+            // WORKAROUND:
+            // Initially we wanted to make that workaround for Runtime UI only,
+            // because only there we had a strict handling for proper application quit
+            // procedure.  But it appeared on X11 (as usually due to an async nature) there
+            // can happen situations that Qt application is checking whether at least one
+            // window is already shown and if not - exits prematurely _before_ it is actually
+            // shown.  That can happen for example if window is not yet shown because blocked
+            // by startup error message-box which is not treated as real window by some
+            // reason.  So we are making application exit manual everywhere.
+            qApp->setQuitOnLastWindowClosed(false);
 
             /* Request to Start UI _after_ QApplication executed: */
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp	(revision 72362)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp	(revision 72363)
@@ -142,4 +142,10 @@
 }
 
+void UIMachine::closeRuntimeUI()
+{
+    /* Quit application: */
+    QApplication::quit();
+}
+
 void UIMachine::sltChangeVisualState(UIVisualStateType visualState)
 {
@@ -304,7 +310,4 @@
     /* Cleanup session UI: */
     cleanupSession();
-
-    /* Quit application: */
-    QApplication::quit();
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h	(revision 72362)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h	(revision 72363)
@@ -71,5 +71,5 @@
 
     /** Close Runtime UI. */
-    void closeRuntimeUI() { destroy(); }
+    void closeRuntimeUI();
 
 private slots:
Index: trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp	(revision 72362)
+++ trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp	(revision 72363)
@@ -1417,4 +1417,13 @@
 #endif /* VBOX_WS_MAC */
 
+void UISelectorWindow::closeEvent(QCloseEvent *pEvent)
+{
+    /* Call to base-class: */
+    QIWithRetranslateUI<QIMainWindow>::closeEvent(pEvent);
+
+    /* Quit application: */
+    QApplication::quit();
+}
+
 void UISelectorWindow::prepare()
 {
Index: trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h	(revision 72362)
+++ trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h	(revision 72363)
@@ -224,16 +224,18 @@
       * @{ */
         /** Handles translation event. */
-        virtual void retranslateUi();
-
-        /** Handles any Qt @a pEvent. */
-        virtual bool event(QEvent *pEvent);
-        /** Handles Qt show @a pEvent. */
-        virtual void showEvent(QShowEvent *pEvent);
-        /** Handles first Qt show @a pEvent. */
-        virtual void polishEvent(QShowEvent *pEvent);
+        virtual void retranslateUi() /* override */;
+
+        /** Handles any @a pEvent. */
+        virtual bool event(QEvent *pEvent) /* override */;
+        /** Handles show @a pEvent. */
+        virtual void showEvent(QShowEvent *pEvent) /* override */;
+        /** Handles first show @a pEvent. */
+        virtual void polishEvent(QShowEvent *pEvent) /* override */;
 #ifdef VBOX_WS_MAC
-        /** Mac OS X: Preprocesses any Qt @a pEvent for passed @a pObject. */
-        virtual bool eventFilter(QObject *pObject, QEvent *pEvent);
-#endif /* VBOX_WS_MAC */
+        /** Mac OS X: Preprocesses any @a pEvent for passed @a pObject. */
+        virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
+#endif
+        /** Handles close @a pEvent. */
+        virtual void closeEvent(QCloseEvent *pEvent) /* override */;
     /** @} */
 
