VirtualBox

Changeset 25027 in vbox


Ignore:
Timestamp:
Nov 26, 2009 5:59:32 PM (15 years ago)
Author:
vboxsync
Message:

VBoxHeadless: properly close session if the VM failed to start (xTracker 4495).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r25016 r25027  
    659659    }
    660660
     661    ComPtr<IVirtualBox> virtualBox;
     662    ComPtr<ISession> session;
     663    bool fSessionOpened = false;
     664
    661665    do
    662666    {
    663         ComPtr<IVirtualBox> virtualBox;
    664         ComPtr<ISession> session;
    665 
    666667        rc = virtualBox.createLocalObject(CLSID_VirtualBox);
    667668        if (FAILED(rc))
     
    708709        // open a session
    709710        CHECK_ERROR_BREAK(virtualBox, OpenSession (session, id));
     711        fSessionOpened = true;
    710712
    711713        /* get the console */
     
    762764        if (rc != S_OK)
    763765        {
    764             return -1;
     766            break;
    765767        }
    766768#endif /* defined(VBOX_FFMPEG) */
     
    784786            {
    785787                RTPrintf("Error: could not create framebuffer object %d\n", uScreenId);
    786                 return -1;
     788                break;
    787789            }
    788790            pVRDPFramebuffer->AddRef();
    789791            display->SetFramebuffer(uScreenId, pVRDPFramebuffer);
     792        }
     793        if (uScreenId < cMonitors)
     794        {
     795            break;
    790796        }
    791797#endif
     
    955961
    956962        /* we don't have to disable VRDP here because we don't save the settings of the VM */
    957 
     963    }
     964    while (0);
     965
     966    if (fSessionOpened)
     967    {
    958968        /*
    959969         * Close the session. This will also uninitialize the console and
     
    963973        session->Close();
    964974    }
    965     while (0);
     975
     976    /* Must be before com::Shutdown */
     977    session.setNull();
     978    virtualBox.setNull();
    966979
    967980    com::Shutdown();
Note: See TracChangeset for help on using the changeset viewer.

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