VirtualBox

Changeset 78202 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 18, 2019 9:51:02 AM (6 years ago)
Author:
vboxsync
Message:

Main/VirtualBox+Machine: Fix bogus saving of VM config when the VM is inaccessible due to the 2nd or further media registry entry, by making sure that the medium registry isn't marked as modified. For good measure block saving of VM configs when they're inaccessible. Thanks, Socratis, for reporting with reproduction instructions in ticketref:17908.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r78124 r78202  
    99119911                 E_FAIL);
    99129912
     9913    if (!mData->mAccessible)
     9914        return setError(VBOX_E_INVALID_VM_STATE,
     9915                        tr("The machine is not accessible, so cannot save settings"));
     9916
    99139917    HRESULT rc = S_OK;
    99149918    bool fNeedsWrite = false;
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r78124 r78202  
    778778
    779779        rc = i_registerMedium(pHardDisk, &pHardDisk, treeLock);
     780        // Avoid trouble with lock/refcount, before returning or not.
     781        treeLock.release();
     782        pHardDisk.setNull();
     783        treeLock.acquire();
    780784        if (FAILED(rc)) return rc;
    781785    }
     
    799803
    800804        rc = i_registerMedium(pImage, &pImage, treeLock);
     805        // Avoid trouble with lock/refcount, before returning or not.
     806        treeLock.release();
     807        pImage.setNull();
     808        treeLock.acquire();
    801809        if (FAILED(rc)) return rc;
    802810    }
     
    820828
    821829        rc = i_registerMedium(pImage, &pImage, treeLock);
     830        // Avoid trouble with lock/refcount, before returning or not.
     831        treeLock.release();
     832        pImage.setNull();
     833        treeLock.acquire();
    822834        if (FAILED(rc)) return rc;
    823835    }
     
    49324944        {
    49334945            AutoCaller machineCaller(pMachine);
    4934             if (SUCCEEDED(machineCaller.rc()))
     4946            if (SUCCEEDED(machineCaller.rc()) && pMachine->i_isAccessible())
    49354947                ASMAtomicIncU64(&pMachine->uRegistryNeedsSaving);
    49364948        }
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