Changeset 103532 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 22, 2024 2:05:31 PM (9 months ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/AutoStateDep.h
r98263 r103532 73 73 mRegistered(FALSE) 74 74 { 75 Assert(aThat);76 mRC = aThat->i_addStateDependency(taDepType, &mMachineState,77 &mRegistered);75 if (RT_VALID_PTR(aThat)) 76 mRC = aThat->i_addStateDependency(taDepType, &mMachineState, 77 &mRegistered); 78 78 } 79 79 ~AutoStateDependency() 80 80 { 81 if ( SUCCEEDED(mRC))81 if (RT_VALID_PTR(mThat) && SUCCEEDED(mRC)) 82 82 mThat->i_releaseStateDependency(); 83 83 } … … 88 88 { 89 89 AssertReturnVoid(SUCCEEDED(mRC)); 90 mThat->i_releaseStateDependency(); 90 if (RT_VALID_PTR(mThat)) 91 mThat->i_releaseStateDependency(); 91 92 mRC = E_FAIL; 92 93 } … … 98 99 { 99 100 AssertReturnVoid(!SUCCEEDED(mRC)); 100 mRC = mThat->i_addStateDependency(taDepType, &mMachineState, 101 &mRegistered); 101 if (RT_VALID_PTR(mThat)) 102 mRC = mThat->i_addStateDependency(taDepType, &mMachineState, 103 &mRegistered); 104 else 105 mRC = S_OK; 102 106 } 103 107 -
trunk/src/VBox/Main/src-all/NvramStoreImpl.cpp
r99739 r103532 380 380 { 381 381 #ifndef VBOX_COM_INPROC 382 /* the machine needs to be mutable */383 AutoMutableStateDependency adep(m->pParent);384 if (FAILED(adep.hrc())) return adep.hrc();385 386 382 Utf8Str strPath; 387 383 NvramStore::getNonVolatileStorageFile(strPath); … … 418 414 { 419 415 m->pUefiVarStore.queryInterfaceTo(aUefiVarStore.asOutParam()); 420 421 /* Mark the NVRAM store as potentially modified. */ 422 m->pParent->i_setModified(Machine::IsModified_NvramStore); 416 /* The "modified" state is handled by i_retainUefiVarStore. */ 423 417 } 424 418 … … 1066 1060 HRESULT NvramStore::i_retainUefiVarStore(PRTVFS phVfs, bool fReadonly) 1067 1061 { 1068 /* the machine needs to be mutable */1069 AutoMutableStateDependency adep( m->pParent);1062 /* the machine needs to be mutable unless fReadonly is set */ 1063 AutoMutableStateDependency adep(fReadonly ? NULL : m->pParent); 1070 1064 if (FAILED(adep.hrc())) return adep.hrc(); 1071 1065 -
trunk/src/VBox/Main/src-server/UefiVariableStoreImpl.cpp
r99739 r103532 152 152 HRESULT UefiVariableStore::getSecureBootEnabled(BOOL *pfEnabled) 153 153 { 154 /* the machine needs to be mutable */155 AutoMutableStateDependency adep(m->pMachine);156 if (FAILED(adep.hrc())) return adep.hrc();157 158 154 HRESULT hrc = i_retainUefiVariableStore(true /*fReadonly*/); 159 155 if (FAILED(hrc)) return hrc; … … 324 320 std::vector<BYTE> &aData) 325 321 { 326 /* the machine needs to be mutable */327 AutoMutableStateDependency adep(m->pMachine);328 if (FAILED(adep.hrc())) return adep.hrc();329 330 322 HRESULT hrc = i_retainUefiVariableStore(true /*fReadonly*/); 331 323 if (FAILED(hrc)) return hrc; … … 370 362 std::vector<com::Guid> &aOwnerUuids) 371 363 { 372 /* the machine needs to be mutable */373 AutoMutableStateDependency adep(m->pMachine);374 if (FAILED(adep.hrc())) return adep.hrc();375 376 364 HRESULT hrc = i_retainUefiVariableStore(true /*fReadonly*/); 377 365 if (FAILED(hrc)) return hrc; … … 522 510 HRESULT UefiVariableStore::enrollDefaultMsSignatures(void) 523 511 { 512 /* the machine needs to be mutable */ 524 513 AutoMutableStateDependency adep(m->pMachine); 525 514 if (FAILED(adep.hrc())) return adep.hrc();
Note:
See TracChangeset
for help on using the changeset viewer.