/** * Uninitializes the Session object. * * @note Locks this object for writing. */ void Session::uninit() { LogFlowThisFuncEnter(); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) { LogFlowThisFunc(("Already uninitialized.\n")); LogFlowThisFuncLeave(); return; } /* close() needs write lock */ AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (mState != SessionState_Unlocked) { Assert(mState == SessionState_Locked || mState == SessionState_Spawning); HRESULT rc = unlockMachine(true /* aFinalRelease */, false /* aFromServer */); AssertComRC(rc); } LogFlowThisFuncLeave(); }
void EventSource::uninit() { { // First of all (before even thinking about entering the uninit span): // make sure that all listeners are are shut down (no pending events or // wait calls), because they cannot be alive without the associated // event source. Otherwise API clients which use long-term (or // indefinite) waits will block VBoxSVC termination (just one example) // for a long time or even infinitely long. AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); if (!m->fShutdown) { m->fShutdown = true; for (Listeners::iterator it = m->mListeners.begin(); it != m->mListeners.end(); ++it) { it->second.obj()->shutdown(); } } } AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; m->mListeners.clear(); // m->mEvMap shall be cleared at this point too by destructors, assert? }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void GuestOSType::uninit() { /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; }
/** * Uninitializes the instance and sets the ready flag to FALSE. * * Called either from FinalRelease() or by the parent when it gets destroyed. */ void Progress::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; /* wake up all threads still waiting on occasion */ if (mWaitersCount > 0) { LogFlow(("WARNING: There are still %d threads waiting for '%s' completion!\n", mWaitersCount, mDescription.c_str())); RTSemEventMultiSignal(mCompletedSem); } RTSemEventMultiDestroy(mCompletedSem); /* release initiator (effective only if mInitiator has been assigned in * * init()) */ unconst(mInitiator).setNull(); #if !defined(VBOX_COM_INPROC) if (mParent) { /* remove the added progress on failure to complete the initialization */ if (autoUninitSpan.initFailed() && mId.isValid() && !mId.isZero()) mParent->i_removeProgress(mId.ref()); unconst(mParent) = NULL; } #endif }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void MediumLockToken::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; /* Release the appropriate lock, check is paranoia */ if (!m.pMedium.isNull()) { if (m.fWrite) { HRESULT rc = m.pMedium->unlockWrite(NULL); AssertComRC(rc); } else { HRESULT rc = m.pMedium->unlockRead(NULL); AssertComRC(rc); } m.pMedium.setNull(); } }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void VirtualBoxClient::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; if (mData.m_ThreadWatcher != NIL_RTTHREAD) { /* Signal the event semaphore and wait for the thread to terminate. * if it hangs for some reason exit anyway, this can cause a crash * though as the object will no longer be available. */ RTSemEventSignal(mData.m_SemEvWatcher); RTThreadWait(mData.m_ThreadWatcher, 30000, NULL); mData.m_ThreadWatcher = NIL_RTTHREAD; RTSemEventDestroy(mData.m_SemEvWatcher); mData.m_SemEvWatcher = NIL_RTSEMEVENT; } mData.m_pVirtualBox.setNull(); ASMAtomicDecU32(&g_cInstances); }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void USBController::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; #ifdef VBOX_WITH_USB // uninit all device filters on the list (it's a standard std::list not an ObjectsList // so we must uninit() manually) for (DeviceFilterList::iterator it = m->llDeviceFilters->begin(); it != m->llDeviceFilters->end(); ++it) (*it)->uninit(); m->llDeviceFilters.free(); #endif m->bd.free(); unconst(m->pPeer) = NULL; unconst(m->pParent) = NULL; delete m; m = NULL; }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void Guest::uninit() { LogFlowThisFunc(("\n")); #ifdef VBOX_WITH_GUEST_CONTROL /* Scope write lock as much as possible. */ { /* * Cleanup must be done *before* AutoUninitSpan to cancel all * all outstanding waits in API functions (which hold AutoCaller * ref counts). */ AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Clean up callback data. */ CallbackMapIter it; for (it = mCallbackMap.begin(); it != mCallbackMap.end(); it++) callbackDestroy(it->first); /* Clear process map. */ mGuestProcessMap.clear(); } #endif /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; unconst(mParent) = NULL; }
void EventSource::uninit() { AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; m->mListeners.clear(); // m->mEvMap shall be cleared at this point too by destructors, assert? }
void DHCPServer::uninit() { /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; unconst(mVirtualBox) = NULL; }
/** * Uninitializes the instance. * Called from FinalRelease(). */ void GuestDnDSource::uninit(void) { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady. */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; }
/** * Uninitializes the instance. * Called from FinalRelease(). */ void PCIDeviceAttachment::uninit() { /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; delete m; m = NULL; }
void NATEngine::uninit() { AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; mNATRules.clear(); mData.free(); unconst(mPeer) = NULL; unconst(mParent) = NULL; }
/** * Uninitializes the instance. * Called from FinalRelease(). */ void GuestFile::uninit(void) { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady. */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; mData.mSession->fileClose(this); }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void SystemProperties::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; unconst(mParent) = NULL; }
/** * Uninitializes the instance. * Called from FinalRelease(). */ void GuestFile::uninit(void) { /* Enclose the state transition Ready->InUninit->NotReady. */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; LogFlowThisFuncEnter(); baseUninit(); LogFlowThisFuncLeave(); }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void MachineDebugger::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; unconst(mParent) = NULL; mFlushMode = false; }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void Guest::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; #ifdef VBOX_WITH_GUEST_CONTROL /* Scope write lock as much as possible. */ { /* * Cleanup must be done *before* AutoUninitSpan to cancel all * all outstanding waits in API functions (which hold AutoCaller * ref counts). */ AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Notify left over callbacks that we are about to shutdown ... */ CallbackMapIter it; for (it = mCallbackMap.begin(); it != mCallbackMap.end(); it++) { int rc2 = callbackNotifyEx(it->first, VERR_CANCELLED, Guest::tr("VM is shutting down, canceling uncompleted guest requests ...")); AssertRC(rc2); } /* Destroy left over callback data. */ for (it = mCallbackMap.begin(); it != mCallbackMap.end(); it++) callbackDestroy(it->first); /* Clear process map (remove all callbacks). */ mGuestProcessMap.clear(); } #endif /* Destroy stat update timer */ int vrc = RTTimerLRDestroy (mStatTimer); AssertMsgRC (vrc, ("Failed to create guest statistics " "update timer(%Rra)\n", vrc)); mStatTimer = NULL; mMagic = 0; #ifdef VBOX_WITH_DRAG_AND_DROP delete m_pGuestDnD; m_pGuestDnD = NULL; #endif unconst(mParent) = NULL; }
void DisplaySourceBitmap::uninit() { /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; LogFlowThisFunc(("[%u]\n", m.uScreenId)); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); m.pDisplay.setNull(); RTMemFree(m.pu8Allocated); }
/** * Uninitializes the instance. * Called from FinalRelease(). */ void GuestFile::uninit(void) { /* Enclose the state transition Ready->InUninit->NotReady. */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; LogFlowThisFuncEnter(); #ifdef VBOX_WITH_GUEST_CONTROL baseUninit(); #endif LogFlowThisFuncLeave(); }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void AudioAdapter::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; mData.free(); unconst(mPeer) = NULL; unconst(mParent) = NULL; }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void SharedFolder::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; unconst(mParent) = NULL; unconst(mMachine) = NULL; unconst(mConsole) = NULL; unconst(mVirtualBox) = NULL; }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void MachineToken::uninit(bool fAbandon) { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; /* Destroy the SessionMachine object, check is paranoia */ if (!m.pSessionMachine.isNull()) { m.pSessionMachine->uninit(fAbandon ? SessionMachine::Uninit::Normal : SessionMachine::Uninit::Abnormal); m.pSessionMachine.setNull(); } }
void VBoxVetoEvent::uninit() { AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; if (!m) return; m->mVetoed = FALSE; if (!m->mEvent.isNull()) { m->mEvent->uninit(); m->mEvent.setNull(); } }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void USBDeviceFilter::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; mInList = false; bd.free(); unconst(mPeer) = NULL; unconst(mParent) = NULL; }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void Guest::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; /* Destroy stat update timer */ int vrc = RTTimerLRDestroy(mStatTimer); AssertMsgRC(vrc, ("Failed to create guest statistics update timer(%Rra)\n", vrc)); mStatTimer = NULL; mMagic = 0; #ifdef VBOX_WITH_GUEST_CONTROL LogFlowThisFunc(("Closing sessions (%RU64 total)\n", mData.mGuestSessions.size())); GuestSessions::iterator itSessions = mData.mGuestSessions.begin(); while (itSessions != mData.mGuestSessions.end()) { #ifdef DEBUG ULONG cRefs = itSessions->second->AddRef(); LogFlowThisFunc(("pSession=%p, cRefs=%RU32\n", (GuestSession *)itSessions->second, cRefs > 0 ? cRefs - 1 : 0)); itSessions->second->Release(); #endif itSessions->second->uninit(); itSessions++; } mData.mGuestSessions.clear(); #endif #ifdef VBOX_WITH_DRAG_AND_DROP if (m_pGuestDnD) { delete m_pGuestDnD; m_pGuestDnD = NULL; } #endif #ifdef VBOX_WITH_GUEST_CONTROL unconst(mEventSource).setNull(); #endif unconst(mParent) = NULL; LogFlowFuncLeave(); }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void BandwidthGroup::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; m->bd.free(); unconst(m->pPeer) = NULL; unconst(m->pParent) = NULL; delete m; m = NULL; }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void SerialPort::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; m->bd.free(); unconst(m->pPeer) = NULL; unconst(m->pMachine) = NULL; delete m; m = NULL; }
/** * Uninitializes the instance. * Called from FinalRelease(). */ void MediumAttachment::uninit() { LogFlowThisFunc(("ENTER - %s\n", i_getLogName())); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; m->bd.free(); unconst(m->pMachine) = NULL; delete m; m = NULL; LogFlowThisFuncLeave(); }
/** * Uninitializes the instance and sets the ready flag to FALSE. * Called either from FinalRelease() or by the parent when it gets destroyed. */ void Mouse::uninit() { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; for (unsigned i = 0; i < MOUSE_MAX_DEVICES; ++i) { if (mpDrv[i]) mpDrv[i]->pMouse = NULL; mpDrv[i] = NULL; } mMouseEvent.uninit(); unconst(mEventSource).setNull(); unconst(mParent) = NULL; }