Changeset 27796 in vbox for trunk/src/VBox/Main/MachineImpl.cpp
- Timestamp:
- Mar 29, 2010 4:04:55 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r27793 r27796 4720 4720 CheckComArgExpr(aData, !ComSafeArrayOutIsNull(aData)); 4721 4721 4722 NOREF(aDataSize); 4723 4722 4724 ReturnComNotImplemented(); 4723 4725 } … … 9139 9141 } 9140 9142 9141 /* We need to lock this object in uninit() because the lock is shared 9142 * with mPeer (as well as data we modify below). mParent->addProcessToReap() 9143 * and others need mParent lock, and USB needs host lock. */ 9144 AutoMultiWriteLock3 alock(mParent, mParent->host(), this COMMA_LOCKVAL_SRC_POS); 9145 9146 #ifdef VBOX_WITH_RESOURCE_USAGE_API 9147 unregisterMetrics(mParent->performanceCollector(), mPeer); 9148 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 9149 9150 MachineState_T lastState = mData->mMachineState; 9143 MachineState_T lastState; 9144 { 9145 AutoReadLock tempLock(this COMMA_LOCKVAL_SRC_POS); 9146 lastState = mData->mMachineState; 9147 } 9151 9148 NOREF(lastState); 9152 9149 9153 if (aReason == Uninit::Abnormal)9154 {9155 LogWarningThisFunc(("ABNORMAL client termination! (wasBusy=%d)\n",9156 Global::IsOnlineOrTransient(lastState)));9157 9158 /* reset the state to Aborted */9159 if (mData->mMachineState != MachineState_Aborted)9160 setMachineState(MachineState_Aborted);9161 }9162 9163 // any machine settings modified?9164 if (m_flModifications)9165 {9166 LogWarningThisFunc(("Discarding unsaved settings changes!\n"));9167 rollback(false /* aNotify */);9168 }9169 9170 Assert(mSnapshotData.mStateFilePath.isEmpty() || !mSnapshotData.mSnapshot);9171 if (!mSnapshotData.mStateFilePath.isEmpty())9172 {9173 LogWarningThisFunc(("canceling failed save state request!\n"));9174 endSavingState(FALSE /* aSuccess */);9175 }9176 else if (!mSnapshotData.mSnapshot.isNull())9177 {9178 LogWarningThisFunc(("canceling untaken snapshot!\n"));9179 9180 /* delete all differencing hard disks created (this will also attach9181 * their parents back by rolling back mMediaData) */9182 rollbackMedia();9183 /* delete the saved state file (it might have been already created) */9184 if (mSnapshotData.mSnapshot->stateFilePath().length())9185 RTFileDelete(mSnapshotData.mSnapshot->stateFilePath().c_str());9186 9187 mSnapshotData.mSnapshot->uninit();9188 }9189 9190 9150 #ifdef VBOX_WITH_USB 9191 / * release all captured USB devices */9151 // release all captured USB devices, but do this before requesting the locks below 9192 9152 if (aReason == Uninit::Abnormal && Global::IsOnline(lastState)) 9193 9153 { … … 9209 9169 } 9210 9170 #endif /* VBOX_WITH_USB */ 9171 9172 // we need to lock this object in uninit() because the lock is shared 9173 // with mPeer (as well as data we modify below). mParent->addProcessToReap() 9174 // and others need mParent lock, and USB needs host lock. 9175 AutoMultiWriteLock3 multilock(mParent, mParent->host(), this COMMA_LOCKVAL_SRC_POS); 9176 9177 #ifdef VBOX_WITH_RESOURCE_USAGE_API 9178 unregisterMetrics(mParent->performanceCollector(), mPeer); 9179 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 9180 9181 if (aReason == Uninit::Abnormal) 9182 { 9183 LogWarningThisFunc(("ABNORMAL client termination! (wasBusy=%d)\n", 9184 Global::IsOnlineOrTransient(lastState))); 9185 9186 /* reset the state to Aborted */ 9187 if (mData->mMachineState != MachineState_Aborted) 9188 setMachineState(MachineState_Aborted); 9189 } 9190 9191 // any machine settings modified? 9192 if (m_flModifications) 9193 { 9194 LogWarningThisFunc(("Discarding unsaved settings changes!\n")); 9195 rollback(false /* aNotify */); 9196 } 9197 9198 Assert(mSnapshotData.mStateFilePath.isEmpty() || !mSnapshotData.mSnapshot); 9199 if (!mSnapshotData.mStateFilePath.isEmpty()) 9200 { 9201 LogWarningThisFunc(("canceling failed save state request!\n")); 9202 endSavingState(FALSE /* aSuccess */); 9203 } 9204 else if (!mSnapshotData.mSnapshot.isNull()) 9205 { 9206 LogWarningThisFunc(("canceling untaken snapshot!\n")); 9207 9208 /* delete all differencing hard disks created (this will also attach 9209 * their parents back by rolling back mMediaData) */ 9210 rollbackMedia(); 9211 /* delete the saved state file (it might have been already created) */ 9212 if (mSnapshotData.mSnapshot->stateFilePath().length()) 9213 RTFileDelete(mSnapshotData.mSnapshot->stateFilePath().c_str()); 9214 9215 mSnapshotData.mSnapshot->uninit(); 9216 } 9211 9217 9212 9218 if (!mData->mSession.mType.isEmpty()) … … 9326 9332 9327 9333 /* leave the exclusive lock before setting the below two to NULL */ 9328 alock.leave();9334 multilock.leave(); 9329 9335 9330 9336 unconst(mParent) = NULL; … … 10818 10824 /* Make sure any transient guest properties get removed from the 10819 10825 * property store on shutdown. */ 10820 10826 10821 10827 HWData::GuestPropertyList::iterator it; 10822 10828 BOOL fNeedsSaving = mHWData->mGuestPropertiesModified;
Note:
See TracChangeset
for help on using the changeset viewer.