Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 27461)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 27462)
@@ -25,4 +25,5 @@
 #include <QApplication>
 #include <QWidget>
+#include <QTimer>
 
 /* Local includes */
@@ -604,16 +605,12 @@
                          console.PowerUpPaused() : console.PowerUp();
 
-#if 0 // TODO: Check immediate failure!
-    /* Check for an immediate failure: */
+    /* Check for immediate failure: */
     if (!console.isOk())
     {
-        vboxProblem().cannotStartMachine(console);
-        machineWindowWrapper()->machineWindow()->close();
+        if (vboxGlobal().showStartVMErrors())
+            vboxProblem().cannotStartMachine(console);
+        QTimer::singleShot(0, this, SLOT(sltCloseVirtualSession()));
         return;
     }
-
-    /* Disable auto-closure because we want to have a chance to show the error dialog on startup failure: */
-    setPreventAutoClose(true);
-#endif
 
     /* Show "Starting/Restoring" progress dialog: */
@@ -623,23 +620,19 @@
         vboxProblem().showModalProgressDialog(progress, machine.GetName(), mainMachineWindow());
 
-#if 0 // TODO: Check immediate failure!
-    /* Check for an progress failure */
+    /* Check for a progress failure: */
     if (progress.GetResultCode() != 0)
     {
-        vboxProblem().cannotStartMachine(progress);
-        machineWindowWrapper()->machineWindow()->close();
+        if (vboxGlobal().showStartVMErrors())
+            vboxProblem().cannotStartMachine(progress);
+        QTimer::singleShot(0, this, SLOT(sltCloseVirtualSession()));
         return;
     }
 
-    /* Enable auto-closure again: */
-    setPreventAutoClose(false);
-
     /* Check if we missed a really quick termination after successful startup, and process it if we did: */
-    if (uisession()->isTurnedOff())
-    {
-        machineWindowWrapper()->machineWindow()->close();
+    if (isTurnedOff())
+    {
+        QTimer::singleShot(0, this, SLOT(sltCloseVirtualSession()));
         return;
     }
-#endif
 
 #if 0 // TODO: Rework debugger logic!
