VirtualBox

Changeset 1013 in vbox


Ignore:
Timestamp:
Feb 21, 2007 5:09:53 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18868
Message:

FE/Qt: Fixed a segfault after showing the message box on startup when the VBoxSVC server is not running.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/COMDefs.cpp

    r967 r1013  
    116116HRESULT COMBase::initializeCOM()
    117117{
    118     LogFlow (("COMBase::initializeCOM(): BEGIN\n"));
     118    LogFlowFuncEnter();
    119119
    120120#if defined (Q_OS_WIN32)
    121121
    122     // disable this damn CoInitialize* somehow made by Qt during creation of
    123     // the QApplication instance (didn't explore deeply why does it do this)
     122    /* disable this damn CoInitialize* somehow made by Qt during
     123     * creation of the QApplication instance (didn't explore deeply
     124     * why does it do this) */
    124125    CoUninitialize();
    125     CoInitializeEx (
    126         NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE | COINIT_SPEED_OVER_MEMORY
    127     );
    128 
    129     LogFlow (("COMBase::initializeCOM(): END\n"));
     126    CoInitializeEx (NULL, COINIT_MULTITHREADED |
     127                          COINIT_DISABLE_OLE1DDE |
     128                          COINIT_SPEED_OVER_MEMORY);
     129
     130    LogFlowFuncLeave();
    130131    return S_OK;
    131132
     
    134135    if (gComponentManager)
    135136    {
    136         LogFlow (("COMBase::initializeCOM(): END\n"));
     137        LogFlowFuncLeave();
    137138        return S_OK;
    138139    }
     
    143144    nsCOMPtr <nsIServiceManager> serviceManager;
    144145
    145     // create a file object containing the path to the executable
     146    /* create a file object containing the path to the executable */
    146147    QCString appDir;
    147148#ifdef DEBUG
     
    160161        if (SUCCEEDED( rc ))
    161162        {
    162             // initialize XPCOM and get the service manager
     163            /* initialize XPCOM and get the service manager */
    163164            rc = NS_InitXPCOM2 (getter_AddRefs (serviceManager), fAppDir, nsnull);
    164165        }
     
    167168    if (SUCCEEDED (rc))
    168169    {
    169         // get the registrar
     170        /* get the registrar */
    170171        nsCOMPtr <nsIComponentRegistrar> registrar =
    171172            do_QueryInterface (serviceManager, &rc);
    172173        if (SUCCEEDED (rc))
    173174        {
    174             // autoregister components from a component directory
     175            /* autoregister components from a component directory */
    175176            registrar->AutoRegister (nsnull);
    176177
    177             // get the component manager
     178            /* get the component manager */
    178179            rc = registrar->QueryInterface (NS_GET_IID (nsIComponentManager),
    179180                                            (void**) &gComponentManager);
    180181            if (SUCCEEDED (rc))
    181182            {
    182                 // get the main thread's event queue (afaik, the dconnect service always
    183                 // gets created upon XPCOM startup, so it will use the main (this)
    184                 // thread's event queue to receive IPC events)
     183                /* get the main thread's event queue (afaik, the
     184                 * dconnect service always gets created upon XPCOM
     185                 * startup, so it will use the main (this) thread's
     186                 * event queue to receive IPC events) */
    185187                rc = NS_GetMainEventQ (&gEventQ);
    186188#ifdef DEBUG
     
    193195# endif
    194196
    195                 // get the IPC service
     197                /* get the IPC service */
    196198                nsCOMPtr <ipcIService> ipcServ =
    197199                    do_GetService (IPC_SERVICE_CONTRACTID, serviceManager, &rc);
    198200                if (SUCCEEDED (rc))
    199201                {
    200                     // get the VirtualBox out-of-proc server ID
     202                    /* get the VirtualBox out-of-proc server ID */
    201203                    rc = ipcServ->ResolveClientName ("VirtualBoxServer",
    202204                                                     &gVBoxServerID);
    203205                    if (SUCCEEDED (rc))
    204206                    {
    205                         // get the DConnect service
     207                        /* get the DConnect service */
    206208                        rc = serviceManager->
    207209                            GetServiceByContractID (IPC_DCONNECTSERVICE_CONTRACTID,
     
    217219        cleanupCOM();
    218220
    219     LogFlow (("COMBase::initializeCOM(): END: rc=%08X\n", rc));
     221    LogFlowFuncLeave();
    220222    return rc;
    221223
     
    228230HRESULT COMBase::cleanupCOM()
    229231{
    230     LogFlow (("COMBase::cleanupCOM(): BEGIN\n"));
     232    LogFlowFuncEnter();
    231233
    232234#if defined (Q_OS_WIN32)
     
    241243        if (isOnCurrentThread)
    242244        {
    243             LogFlow (("COMBase::cleanupCOM(): doing cleanup...\n"));
     245            LogFlowFunc (("Doing cleanup...\n"));
    244246# if !defined (__DARWIN__) && !defined (__OS2__)
    245247            if (gSocketListener)
     
    247249# endif
    248250            if (gDConnectService)
     251            {
    249252                gDConnectService->Release();
     253                gDConnectService = nsnull;
     254            }
    250255            if (gEventQ)
     256            {
    251257                gEventQ->Release();
     258                gEventQ = nsnull;
     259            }
    252260            gComponentManager->Release();
     261            gComponentManager = nsnull;
     262            /* note: gComponentManager = nsnull indicates that we're
     263             * cleaned up */
    253264            NS_ShutdownXPCOM (nsnull);
    254265            XPCOMGlueShutdown();
     
    257268#endif
    258269
    259     LogFlow (("COMBase::cleanupCOM(): END\n"));
     270    LogFlowFuncLeave();
    260271    return S_OK;
    261272}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette