VirtualBox

Changeset 5642 in vbox


Ignore:
Timestamp:
Nov 8, 2007 11:07:42 AM (17 years ago)
Author:
vboxsync
Message:

Main: Return an error when two machines witht he same UUID are detected in the global registry instead of asserting.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r5627 r5642  
    29832983             ++ it)
    29842984        {
     2985            /* sanity */
    29852986            AutoLimitedCaller machCaller (*it);
    29862987            AssertComRC (machCaller.rc());
     
    38943895    AutoLock alock (this);
    38953896
    3896     ComAssertRet (findMachine (aMachine->uuid(),
    3897                   false /* aDoSetError  */, NULL) == E_INVALIDARG,
    3898                   E_FAIL);
    3899 
    39003897    HRESULT rc = S_OK;
     3898
     3899    {
     3900        ComObjPtr <Machine> m;
     3901        rc = findMachine (aMachine->uuid(), false /* aDoSetError */, &m);
     3902        if (SUCCEEDED (rc))
     3903        {
     3904            /* sanity */
     3905            AutoLimitedCaller machCaller (m);
     3906            AssertComRC (machCaller.rc());
     3907
     3908            return setError (E_INVALIDARG,
     3909                tr ("Registered machine with UUID {%Vuuid} ('%ls') already exists"),
     3910                aMachine->uuid().raw(), m->settingsFileFull().raw());
     3911        }
     3912
     3913        ComAssertRet (rc == E_INVALIDARG, rc);
     3914        rc = S_OK;
     3915    }
    39013916
    39023917    if (autoCaller.state() != InInit)
  • trunk/src/VBox/Main/include/MachineImpl.h

    r5627 r5642  
    530530
    531531    /**
     532     *  Returns this machine's full settings file path.
     533     *
     534     *  @note This method doesn't lock this object or check its readiness as
     535     *  it is intended to be used only after adding a caller to this object
     536     *  (that guarantees that the object is ready) and locking it for reading.
     537     */
     538    const Bstr &settingsFileFull() const { return mData->mConfigFileFull; }
     539
     540    /**
    532541     *  Returns this machine's name.
    533542     *
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