Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp	(revision 52997)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp	(revision 52998)
@@ -37,15 +37,14 @@
 
 /* static */
-UIConsoleEventHandler *UIConsoleEventHandler::m_pInstance = 0;
+UIConsoleEventHandler *UIConsoleEventHandler::m_spInstance = 0;
 
 /* static */
-UIConsoleEventHandler* UIConsoleEventHandler::instance(UISession *pSession /* = 0 */)
-{
-    if (!m_pInstance)
+void UIConsoleEventHandler::create(UISession *pSession)
+{
+    if (!m_spInstance)
     {
-        m_pInstance = new UIConsoleEventHandler(pSession);
-        m_pInstance->prepare();
+        m_spInstance = new UIConsoleEventHandler(pSession);
+        m_spInstance->prepare();
     }
-    return m_pInstance;
 }
 
@@ -53,9 +52,9 @@
 void UIConsoleEventHandler::destroy()
 {
-    if (m_pInstance)
+    if (m_spInstance)
     {
-        m_pInstance->cleanup();
-        delete m_pInstance;
-        m_pInstance = 0;
+        m_spInstance->cleanup();
+        delete m_spInstance;
+        m_spInstance = 0;
     }
 }
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h	(revision 52997)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h	(revision 52998)
@@ -73,6 +73,8 @@
 public:
 
-    /** Static instance factory. */
-    static UIConsoleEventHandler* instance(UISession *pSession = 0);
+    /** Static instance wrapper. */
+    static UIConsoleEventHandler* instance() { return m_spInstance; }
+    /** Static instance constructor. */
+    static void create(UISession *pSession);
     /** Static instance destructor. */
     static void destroy();
@@ -96,5 +98,5 @@
 
     /** Holds the static instance. */
-    static UIConsoleEventHandler *m_pInstance;
+    static UIConsoleEventHandler *m_spInstance;
 
     /** Holds the UI session reference. */
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 52997)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp	(revision 52998)
@@ -968,6 +968,6 @@
 void UISession::prepareConsoleEventHandlers()
 {
-    /* Initialize console event-handler: */
-    UIConsoleEventHandler::instance(this);
+    /* Create console event-handler: */
+    UIConsoleEventHandler::create(this);
 
     /* Add console event connections: */
@@ -1029,83 +1029,83 @@
     m_pActionPool->toRuntime()->setSession(this);
 
-    /* Get host/machine: */
-    const CHost host = vboxGlobal().host();
-    const CMachine machine = session().GetConsole().GetMachine();
-    UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restriction = UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid;
-
-    /* Storage stuff: */
-    {
-        /* Initialize CD/FD menus: */
-        int iDevicesCountCD = 0;
-        int iDevicesCountFD = 0;
-        foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments())
-        {
-            if (attachment.GetType() == KDeviceType_DVD)
-                ++iDevicesCountCD;
-            if (attachment.GetType() == KDeviceType_Floppy)
-                ++iDevicesCountFD;
-        }
-        QAction *pOpticalDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices);
-        QAction *pFloppyDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices);
-        pOpticalDevicesMenu->setData(iDevicesCountCD);
-        pFloppyDevicesMenu->setData(iDevicesCountFD);
-        if (!iDevicesCountCD)
-            restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices);
-        if (!iDevicesCountFD)
-            restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices);
-    }
-
-    /* Network stuff: */
-    {
-        /* Initialize Network menu: */
-        bool fAtLeastOneAdapterActive = false;
-        const KChipsetType chipsetType = machine.GetChipsetType();
-        ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType);
-        for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot)
-        {
-            const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);
-            if (adapter.GetEnabled())
+        /* Get host/machine: */
+        const CHost host = vboxGlobal().host();
+        const CMachine machine = session().GetConsole().GetMachine();
+        UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restriction = UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid;
+
+        /* Storage stuff: */
+        {
+            /* Initialize CD/FD menus: */
+            int iDevicesCountCD = 0;
+            int iDevicesCountFD = 0;
+            foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments())
             {
-                fAtLeastOneAdapterActive = true;
-                break;
+                if (attachment.GetType() == KDeviceType_DVD)
+                    ++iDevicesCountCD;
+                if (attachment.GetType() == KDeviceType_Floppy)
+                    ++iDevicesCountFD;
             }
-        }
-        if (!fAtLeastOneAdapterActive)
-            restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network);
-    }
-
-    /* USB stuff: */
-    {
-        /* Check whether there is at least one USB controller with an available proxy. */
-        const bool fUSBEnabled =    !machine.GetUSBDeviceFilters().isNull()
-                                 && !machine.GetUSBControllers().isEmpty()
-                                 && machine.GetUSBProxyAvailable();
-        if (!fUSBEnabled)
-            restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);
-    }
-
-    /* WebCams stuff: */
-    {
-        /* Check whether there is an accessible video input devices pool: */
-        host.GetVideoInputDevices();
-        const bool fWebCamsEnabled = host.isOk() && !machine.GetUSBControllers().isEmpty();
-        if (!fWebCamsEnabled)
-            restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);
-    }
-
-    /* Apply cumulative restriction: */
-    actionPool()->toRuntime()->setRestrictionForMenuDevices(UIActionRestrictionLevel_Session, restriction);
+            QAction *pOpticalDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices);
+            QAction *pFloppyDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices);
+            pOpticalDevicesMenu->setData(iDevicesCountCD);
+            pFloppyDevicesMenu->setData(iDevicesCountFD);
+            if (!iDevicesCountCD)
+                restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices);
+            if (!iDevicesCountFD)
+                restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices);
+        }
+
+        /* Network stuff: */
+        {
+            /* Initialize Network menu: */
+            bool fAtLeastOneAdapterActive = false;
+            const KChipsetType chipsetType = machine.GetChipsetType();
+            ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType);
+            for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot)
+            {
+                const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);
+                if (adapter.GetEnabled())
+                {
+                    fAtLeastOneAdapterActive = true;
+                    break;
+                }
+            }
+            if (!fAtLeastOneAdapterActive)
+                restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network);
+        }
+
+        /* USB stuff: */
+        {
+            /* Check whether there is at least one USB controller with an available proxy. */
+            const bool fUSBEnabled =    !machine.GetUSBDeviceFilters().isNull()
+                                     && !machine.GetUSBControllers().isEmpty()
+                                     && machine.GetUSBProxyAvailable();
+            if (!fUSBEnabled)
+                restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);
+        }
+
+        /* WebCams stuff: */
+        {
+            /* Check whether there is an accessible video input devices pool: */
+            host.GetVideoInputDevices();
+            const bool fWebCamsEnabled = host.isOk() && !machine.GetUSBControllers().isEmpty();
+            if (!fWebCamsEnabled)
+                restriction = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restriction | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);
+        }
+
+        /* Apply cumulative restriction: */
+        actionPool()->toRuntime()->setRestrictionForMenuDevices(UIActionRestrictionLevel_Session, restriction);
 
 #ifdef Q_WS_MAC
-    /* Create Mac OS X menu-bar: */
-    m_pMenuBar = new UIMenuBar;
-    AssertPtrReturnVoid(m_pMenuBar);
-    {
-        /* Configure Mac OS X menu-bar: */
-        connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange()),
-                this, SLOT(sltHandleMenuBarConfigurationChange()));
-        /* Update Mac OS X menu-bar: */
-        updateMenu();
-    }
+        /* Create Mac OS X menu-bar: */
+        m_pMenuBar = new UIMenuBar;
+        AssertPtrReturnVoid(m_pMenuBar);
+        {
+            /* Configure Mac OS X menu-bar: */
+            connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange()),
+                    this, SLOT(sltHandleMenuBarConfigurationChange()));
+            /* Update Mac OS X menu-bar: */
+            updateMenu();
+        }
 #endif /* Q_WS_MAC */
 }
@@ -1292,5 +1292,5 @@
 {
     /* Destroy console event-handler: */
-    UIConsoleEventHandler::destroy();
+        UIConsoleEventHandler::destroy();
 }
 
