VirtualBox

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


Ignore:
Timestamp:
Mar 4, 2022 10:09:02 PM (3 years ago)
Author:
vboxsync
Message:

Main/Machine: Additional IMachine methods need machine state check
enforcement. bugref:5490

All IMachine methods and attribute setters which modify a VM's settings
or configuration need to detect and reject attempts to use an immutable
Machine object rather than a mutable session object from
ISession::machine(). The following routines: setCPUExecutionCap(),
setMemoryBalloonSize(), setPageFusionEnabled(), setClipboardMode(),
setClipboardFileTransfersEnabled(), setDnDMode(), hotPlugCPU(), and
hotUnplugCPU() need updating to include a call to i_checkStateDependency()
to enforce this.

File:
1 edited

Legend:

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

    r94090 r94092  
    16001600    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    16011601
     1602    rc = i_checkStateDependency(MutableOrRunningStateDep);
     1603    if (FAILED(rc)) return rc;
     1604
    16021605    alock.release();
    16031606    rc = i_onCPUExecutionCapChange(aCPUExecutionCap);
     
    18121815    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    18131816
     1817    HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);
     1818    if (FAILED(rc)) return rc;
     1819
    18141820    i_setModified(IsModified_MachineData);
    18151821    mHWData.backup();
     
    18351841#ifdef VBOX_WITH_PAGE_SHARING
    18361842    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1843
     1844    HRESULT rc = i_checkStateDependency(MutableStateDep);
     1845    if (FAILED(rc)) return rc;
    18371846
    18381847    /** @todo must support changes for running vms and keep this in sync with IGuest. */
     
    26512660    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    26522661
     2662    rc = i_checkStateDependency(MutableOrRunningStateDep);
     2663    if (FAILED(rc)) return rc;
     2664
    26532665    alock.release();
    26542666    rc = i_onClipboardModeChange(aClipboardMode);
     
    26822694    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    26832695
     2696    rc = i_checkStateDependency(MutableOrRunningStateDep);
     2697    if (FAILED(rc)) return rc;
     2698
    26842699    alock.release();
    26852700    rc = i_onClipboardFileTransferModeChange(aEnabled);
     
    27122727
    27132728    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     2729
     2730    rc = i_checkStateDependency(MutableOrRunningStateDep);
     2731    if (FAILED(rc)) return rc;
    27142732
    27152733    alock.release();
     
    64106428        return setError(VBOX_E_OBJECT_IN_USE, tr("CPU %lu is already attached"), aCpu);
    64116429
     6430    rc = i_checkStateDependency(MutableOrRunningStateDep);
     6431    if (FAILED(rc)) return rc;
     6432
    64126433    alock.release();
    64136434    rc = i_onCPUChange(aCpu, false);
     
    64466467    if (aCpu == 0)
    64476468        return setError(E_INVALIDARG, tr("It is not possible to detach CPU 0"));
     6469
     6470    rc = i_checkStateDependency(MutableOrRunningStateDep);
     6471    if (FAILED(rc)) return rc;
    64486472
    64496473    alock.release();
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