Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h	(revision 15621)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h	(revision 15622)
@@ -1051,8 +1051,6 @@
 
 #ifdef VBOX_GUI_WITH_SYSTRAY
-    bool mIsTrayMenu : 1; /*< Tray icon active/desired? */
-    bool mIncreasedWindowCounter : 1;
+    bool mIsTrayMenu;           /* Tray icon active/desired? */
 #endif
-
     QThread *mMediaEnumThread;
     VBoxMediaList mMediaList;
Index: trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp	(revision 15621)
+++ trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp	(revision 15622)
@@ -1256,5 +1256,4 @@
 #ifdef VBOX_GUI_WITH_SYSTRAY
     , mIsTrayMenu (false)
-    , mIncreasedWindowCounter (false)
 #endif
     , mMediaEnumThread (NULL)
@@ -5306,39 +5305,10 @@
     }
 
-    /* create default non-null global settings */
-    gset = VBoxGlobalSettings (false);
-
-    /* try to load global settings */
-    gset.load (mVBox);
-    if (!mVBox.isOk() || !gset)
-    {
-        vboxProblem().cannotLoadGlobalConfig (mVBox, gset.lastError());
-        return;
-    }
-
-    /* Load the customized language as early as possible to get possible error
-     * messages translated */
-    QString languageId = gset.languageId();
-    if (!languageId.isNull())
-        loadLanguage (languageId);
-
-    retranslateUi();
-
-    /* Note: the settings conversion check must be done before anything else
-     * that may unconditionally overwrite settings files in the new format (like
-     * SetExtraData()). But after loading the proper the language. */
-    if (!checkForAutoConvertedSettings())
-        return;
-
 #ifdef VBOX_GUI_WITH_SYSTRAY
-    {
-        /* Increase open Fe/Qt4 windows reference count. */
-        int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() + 1;
-        AssertMsgReturnVoid ((c >= 0) || (mVBox.isOk()),
-            ("Something went wrong with the window reference count!"));
-        mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount, QString ("%1").arg (c));
-        mIncreasedWindowCounter = mVBox.isOk();
-        AssertReturnVoid (mIncreasedWindowCounter);
-    }
+    /* Increase open Fe/Qt4 windows reference count. */
+    int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() + 1;
+    AssertMsg ((c>=0) || (mVBox.isOk()),
+        ("Something went wrong with the window reference count!"));
+    mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount, QString ("%1").arg (c));
 #endif
 
@@ -5497,4 +5467,22 @@
     qApp->installEventFilter (this);
 
+    /* create default non-null global settings */
+    gset = VBoxGlobalSettings (false);
+
+    /* try to load global settings */
+    gset.load (mVBox);
+    if (!mVBox.isOk() || !gset)
+    {
+        vboxProblem().cannotLoadGlobalConfig (mVBox, gset.lastError());
+        return;
+    }
+
+    /* Load customized language if any */
+    QString languageId = gset.languageId();
+    if (!languageId.isNull())
+        loadLanguage (languageId);
+
+    retranslateUi();
+
     /* process command line */
 
@@ -5613,24 +5601,4 @@
     }
 
-#ifdef VBOX_GUI_WITH_SYSTRAY
-    if (mIncreasedWindowCounter)
-    {
-        /* Decrease open Fe/Qt4 windows reference count. */
-        int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() - 1;
-        AssertMsg ((c >= 0) || (mVBox.isOk()),
-            ("Something went wrong with the window reference count!"));
-        if (c < 0)
-            c = 0;   /* Clean up the mess. */
-        mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount,
-                            (c > 0) ? QString ("%1").arg (c) : NULL);
-        AssertWrapperOk (mVBox);
-        if (c == 0)
-        {
-            mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, NULL);
-            AssertWrapperOk (mVBox);
-        }
-    }
-#endif
-
     if (!callback.isNull())
     {
@@ -5657,4 +5625,16 @@
     if (mSelectorWnd)
         delete mSelectorWnd;
+
+#ifdef VBOX_GUI_WITH_SYSTRAY
+    /* Decrease open Fe/Qt4 windows reference count. */
+    int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() - 1;
+    AssertMsg ((c>=0) || (mVBox.isOk()),
+        ("Something went wrong with the window reference count!"));
+    if (c < 0)
+        c = 0;   /* Clean up the mess. */
+    mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount, (c > 0) ? QString ("%1").arg (c) : NULL);
+    if (c == 0)
+        mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, NULL);
+#endif
 
     /* ensure CGuestOSType objects are no longer used */
Index: trunk/src/VBox/Frontends/VirtualBox4/src/main.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/src/main.cpp	(revision 15621)
+++ trunk/src/VBox/Frontends/VirtualBox4/src/main.cpp	(revision 15622)
@@ -346,4 +346,10 @@
                 break;
 
+            /* Note: the settings conversion check must be done before
+             * anything else that can unconditionally overwrite settings files
+             * int he new format (like the license thingy below) */
+            if (!vboxGlobal().checkForAutoConvertedSettings())
+                break;
+
 #ifndef VBOX_OSE
 #ifdef Q_WS_X11
