/** * Initializes the Serial Port object given another serial port object * (a kind of copy constructor). This object shares data with * the object passed as an argument. * * @note This object must be destroyed before the original object * it shares data with is destroyed. * * @note Locks @a aThat object for reading. */ HRESULT SerialPort::init(Machine *aParent, SerialPort *aThat) { LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); ComAssertRet(aParent && aThat, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); m = new Data(); unconst(m->pMachine) = aParent; unconst(m->pPeer) = aThat; AutoCaller thatCaller (aThat); AssertComRCReturnRC(thatCaller.rc()); AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS); m->bd.share (aThat->m->bd); /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * Initializes the guest object given another guest object * (a kind of copy constructor). This object makes a private copy of data * of the original object passed as an argument. * * @note Locks @a aThat object for reading. */ HRESULT NetworkAdapter::initCopy(Machine *aParent, NetworkAdapter *aThat) { LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); ComAssertRet(aParent && aThat, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); unconst(mParent) = aParent; /* mPeer is left null */ unconst(mNATEngine).createObject(); mNATEngine->initCopy(aParent, this, aThat->mNATEngine); AutoCaller thatCaller(aThat); AssertComRCReturnRC(thatCaller.rc()); AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS); mData.attachCopy(aThat->mData); /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * 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 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 }
HRESULT DHCPServer::init(VirtualBox *aVirtualBox, const settings::DHCPServer &data) { /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); /* share VirtualBox weakly (parent remains NULL so far) */ unconst(mVirtualBox) = aVirtualBox; unconst(mName) = data.strNetworkName; m->IPAddress = data.strIPAddress; m->enabled = data.fEnabled; m->lowerIP = data.strIPLower; m->upperIP = data.strIPUpper; m->GlobalDhcpOptions.clear(); m->GlobalDhcpOptions.insert(data.GlobalDhcpOptions.begin(), data.GlobalDhcpOptions.end()); m->VmSlot2Options.clear(); m->VmSlot2Options.insert(data.VmSlot2OptionsM.begin(), data.VmSlot2OptionsM.end()); autoInitSpan.setSucceeded(); return S_OK; }
/** * Initializes the mouse object. * * @returns COM result indicator * @param parent handle of our parent object */ HRESULT Mouse::init (Console *parent) { LogFlowThisFunc(("\n")); ComAssertRet(parent, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); unconst(mParent) = parent; #ifndef VBOXBFE_WITHOUT_COM unconst(mEventSource).createObject(); HRESULT rc = mEventSource->init(static_cast<IMouse*>(this)); AssertComRCReturnRC(rc); mMouseEvent.init(mEventSource, VBoxEventType_OnGuestMouse, 0, 0, 0, 0, 0); #endif /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
Data(Machine * const aMachine) : pVirtualBox(NULL), pSystemProperties(NULL), pParent(aMachine) { unconst(pVirtualBox) = aMachine->i_getVirtualBox(); unconst(pSystemProperties) = pVirtualBox->i_getSystemProperties(); }
void NATEngine::uninit() { AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; mNATRules.clear(); mData.free(); unconst(mPeer) = NULL; unconst(mParent) = NULL; }
int main(void){ const int x = 10; unconst(x) = 20; //may not work printf("%d\n", x); int y = 10; unconst(y) = 20; printf("%d\n", y); return 0; }
/** * Initializes the medium attachment object. * * @param aParent Machine object. * @param aMedium Medium object. * @param aControllerName Controller the hard disk is attached to. * @param aPort Port number. * @param aDevice Device number on the port. * @param aType Device type. * @param aImplicit * @param aPassthrough Whether accesses are directly passed to the host drive. * @param aTempEject Whether guest-triggered eject results in unmounting the medium. * @param aNonRotational Whether this medium is non-rotational (aka SSD). * @param aDiscard Whether this medium supports discarding unused blocks. * @param aHotPluggable Whether this medium is hot-pluggable. * @param strBandwidthGroup Bandwidth group. */ HRESULT MediumAttachment::init(Machine *aParent, Medium *aMedium, const Utf8Str &aControllerName, LONG aPort, LONG aDevice, DeviceType_T aType, bool aImplicit, bool aPassthrough, bool aTempEject, bool aNonRotational, bool aDiscard, bool aHotPluggable, const Utf8Str &strBandwidthGroup) { LogFlowThisFuncEnter(); LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%s aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d aNonRotational=%d aDiscard=%d aHotPluggable=%d strBandwithGroup=%s\n", aParent, aMedium, aControllerName.c_str(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject, aNonRotational, aDiscard, aHotPluggable, strBandwidthGroup.c_str())); if (aType == DeviceType_HardDisk) AssertReturn(aMedium, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); m = new Data(); unconst(m->pMachine) = aParent; m->bd.allocate(); m->bd->pMedium = aMedium; m->bd->mData.strBwGroup = strBandwidthGroup; unconst(m->bd->strControllerName) = aControllerName; m->bd->mData.lPort = aPort; m->bd->mData.lDevice = aDevice; m->bd->mData.deviceType = aType; m->bd->mData.fPassThrough = aPassthrough; m->bd->mData.fTempEject = aTempEject; m->bd->mData.fNonRotational = aNonRotational; m->bd->mData.fDiscard = aDiscard; m->bd->fImplicit = aImplicit; m->bd->mData.fHotPluggable = aHotPluggable; /* Confirm a successful initialization when it's the case */ autoInitSpan.setSucceeded(); /* Construct a short log name for this attachment. */ i_updateLogName(); LogFlowThisFunc(("LEAVE - %s\n", i_getLogName())); return S_OK; }
HRESULT NATEngine::init(Machine *aParent, INetworkAdapter *aAdapter) { AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); autoInitSpan.setSucceeded(); m_fModified = false; mData.allocate(); mData->mNetwork.setNull(); mData->mBindIP.setNull(); unconst(mParent) = aParent; unconst(mAdapter) = aAdapter; return S_OK; }
/** * 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; }
/** * VFSExplorer COM initializer. * @param * @return */ HRESULT VFSExplorer::init(VFSType_T aType, Utf8Str aFilePath, Utf8Str aHostname, Utf8Str aUsername, Utf8Str aPassword, VirtualBox *aVirtualBox) { /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); /* Weak reference to a VirtualBox object */ unconst(mVirtualBox) = aVirtualBox; /* initialize data */ m = new Data; m->storageType = aType; m->strPath = aFilePath; m->strHostname = aHostname; m->strUsername = aUsername; m->strPassword = aPassword; if (m->storageType == VFSType_S3) { size_t bpos = aFilePath.find("/", 1); if (bpos != Utf8Str::npos) { m->strBucket = aFilePath.substr(1, bpos - 1); /* The bucket without any slashes */ aFilePath = aFilePath.substr(bpos); /* The rest of the file path */ } } /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
// finds the path to the MountInfo associated with a mountTreeItem // given a path to the 'item' itself. // 'item' is the mountTreeItem // 'endComp' is the last PathComp leading to 'item' // 'start' is the start of the path to the item char * uio_mountTreeItemRestPath(const uio_MountTreeItem *item, uio_PathComp *endComp, const char *path) { int i; const char *pathPtr; i = item->depth; while (i--) endComp = endComp->up; pathPtr = path; if (endComp != NULL) { while (1) { pathPtr += endComp->nameLen; endComp = endComp->up; if (endComp == NULL) break; pathPtr++; // for a '/' } } if (*path == '/') { // / at the beginning of the path pathPtr++; } if (*pathPtr == '/') { // / at the end of the path pathPtr++; } // return (char *) pathPtr; // gives warning // return *((char **)((void *) &pathPtr)); // not portable return (char *) unconst((const void *) pathPtr); }
/** * Initializes the audio adapter object. * * @param aParent Handle of the parent object. */ HRESULT AudioAdapter::init (Machine *aParent) { LogFlowThisFunc(("aParent=%p\n", aParent)); ComAssertRet(aParent, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); /* Get the default audio driver out of the system properties */ ComPtr<IVirtualBox> VBox; HRESULT rc = aParent->COMGETTER(Parent)(VBox.asOutParam()); if (FAILED(rc)) return rc; ComPtr<ISystemProperties> sysProps; rc = VBox->COMGETTER(SystemProperties)(sysProps.asOutParam()); if (FAILED(rc)) return rc; AudioDriverType_T defaultAudioDriver; rc = sysProps->COMGETTER(DefaultAudioDriver)(&defaultAudioDriver); if (FAILED(rc)) return rc; unconst(mParent) = aParent; /* mPeer is left null */ mData.allocate(); mData->mAudioDriver = defaultAudioDriver; /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * Initializes the object (called right after construction). * * @returns VBox status code. */ int USBProxyBackendSolaris::init(USBProxyService *aUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress) { USBProxyBackend::init(aUsbProxyService, strId, strAddress); unconst(m_strBackend) = Utf8Str("host"); /* * Create semaphore. */ int rc = RTSemEventCreate(&mNotifyEventSem); if (RT_FAILURE(rc)) return rc; /* * Initialize the USB library. */ rc = USBLibInit(); if (RT_FAILURE(rc)) { /* mNotifyEventSem will be destroyed in uninit */ return rc; } mUSBLibInitialized = true; /* * Start the poller thread. */ start(); return VINF_SUCCESS; }
/** * Returns generated tooltip for this medium. * * In "don't show diffs" mode (where the attributes of the base hard disk are * shown instead of the attributes of the differencing hard disk), extra * information will be added to the tooltip to give the user a hint that the * medium is actually a differencing hard disk. * * @param aNoDiffs @c true to enable user-friendly "don't show diffs" mode. * @param aCheckRO @c true to perform the #readOnly() check and add a notice * accordingly. */ QString UIMedium::toolTip (bool aNoDiffs /* = false */, bool aCheckRO /* = false */, bool aNullAllowed /* = false */) const { QString sTip; if (mMedium.isNull()) { sTip = aNullAllowed ? mRow.arg (VBoxGlobal::tr ("<b>No medium selected</b>", "medium")) + mRow.arg (VBoxGlobal::tr ("You can also change this while the machine is running.")) : mRow.arg (VBoxGlobal::tr ("<b>No media available</b>", "medium")) + mRow.arg (VBoxGlobal::tr ("You can create media images using the virtual media manager.")); } else { unconst (this)->checkNoDiffs (aNoDiffs); sTip = aNoDiffs ? mNoDiffs.toolTip : mToolTip; if (aCheckRO && mIsReadOnly) sTip += mRow.arg ("<hr>") + mRow.arg (VBoxGlobal::tr ("Attaching this hard disk will be performed indirectly using " "a newly created differencing hard disk.", "medium")); } return mTable.arg (sTip); }
/** * Initializes the USB devic filters object given another USB filters object * (a kind of copy constructor). This object shares data with * the object passed as an argument. * * @returns COM result indicator. * @param aParent Pointer to our parent object. * @param aPeer The object to share. * * @note This object must be destroyed before the original object * it shares data with is destroyed. */ HRESULT USBDeviceFilters::init(Machine *aParent, USBDeviceFilters *aPeer) { LogFlowThisFunc(("aParent=%p, aPeer=%p\n", aParent, aPeer)); ComAssertRet(aParent && aPeer, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); m = new Data(aParent); unconst(m->pPeer) = aPeer; AutoWriteLock thatlock(aPeer COMMA_LOCKVAL_SRC_POS); #ifdef VBOX_WITH_USB /* create copies of all filters */ m->llDeviceFilters.allocate(); DeviceFilterList::const_iterator it = aPeer->m->llDeviceFilters->begin(); while (it != aPeer->m->llDeviceFilters->end()) { ComObjPtr<USBDeviceFilter> pFilter; pFilter.createObject(); pFilter->init(this, *it); m->llDeviceFilters->push_back(pFilter); ++it; } #endif /* VBOX_WITH_USB */ /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * 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; }
/** * Initializes the Serial Port object. * * @param aParent Handle of the parent object. */ HRESULT SerialPort::init(Machine *aParent, ULONG aSlot) { LogFlowThisFunc(("aParent=%p, aSlot=%d\n", aParent, aSlot)); ComAssertRet(aParent, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); m = new Data(); unconst(m->pMachine) = aParent; /* m->pPeer is left null */ m->bd.allocate(); /* initialize data */ m->bd->ulSlot = aSlot; /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * Initializes the USB device filter object (short version). * * @param aParent Handle of the parent object. */ HRESULT HostUSBDeviceFilter::init(Host *aParent, IN_BSTR aName) { LogFlowThisFunc(("aParent=%p\n", aParent)); ComAssertRet(aParent && aName && *aName, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); unconst(mParent) = aParent; /* register with parent early, since uninit() will unconditionally * unregister on failure */ mParent->i_addChild(this); bd.allocate(); bd->mData.strName = Utf8Str(aName); bd->mData.fActive = FALSE; mInList = false; USBFilterInit(&bd->mUSBFilter, USBFILTERTYPE_IGNORE); bd->mRemote = NULL; bd->mData.ulMaskedInterfaces = 0; /* Confirm successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * 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; }
/** * Cancels sharing (if any) by making an independent copy of data. * This operation also resets this object's peer to NULL. * * @note Locks this object for writing, together with the peer object * represented by @a aThat (locked for reading). */ void USBDeviceFilter::unshare() { /* sanity */ AutoCaller autoCaller(this); AssertComRCReturnVoid(autoCaller.rc()); /* sanity too */ AutoCaller peerCaller(mPeer); AssertComRCReturnVoid(peerCaller.rc()); /* peer is not modified, lock it for reading (mPeer is "master" so locked * first) */ AutoReadLock rl(mPeer COMMA_LOCKVAL_SRC_POS); AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS); if (bd.isShared()) { if (!bd.isBackedUp()) bd.backup(); bd.commit(); } unconst(mPeer) = NULL; }
/** * Initializes the guest object given another guest object * (a kind of copy constructor). This object makes a private copy of data * of the original object passed as an argument. * * @note Locks @a aThat object for reading. */ HRESULT USBDeviceFilter::initCopy(USBDeviceFilters *aParent, USBDeviceFilter *aThat) { LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); ComAssertRet(aParent && aThat, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); unconst(mParent) = aParent; /* mPeer is left null */ m_fModified = false; /* sanity */ AutoCaller thatCaller(aThat); AssertComRCReturnRC(thatCaller.rc()); AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS); bd.attachCopy(aThat->bd); /* reset the arbitrary ID field * (this field is something unique that two distinct objects, even if they * are deep copies of each other, should not share) */ bd->mId = NULL; mInList = aThat->mInList; /* Confirm successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * Initializes the USB device filter object (short version). * * @param aParent Handle of the parent object. */ HRESULT USBDeviceFilter::init(USBDeviceFilters *aParent, IN_BSTR aName) { LogFlowThisFunc(("aParent=%p\n", aParent)); ComAssertRet(aParent && aName && *aName, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); unconst(mParent) = aParent; /* mPeer is left null */ m_fModified = false; bd.allocate(); bd->mData.strName = Utf8Str(aName); bd->mData.fActive = FALSE; bd->mData.ulMaskedInterfaces = 0; /* initialize all filters to any match using null string */ USBFilterInit(&bd->mUSBFilter, USBFILTERTYPE_CAPTURE); bd->mRemote = NULL; mInList = false; /* Confirm successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * Waits for a formerly registered guest event. * * @return IPRT status code. * @param pEvent Pointer to event to wait for. * @param uTimeoutMS Timeout (in ms) for waiting. * @param pType Event type of following IEvent. * Optional. * @param ppEvent Pointer to IEvent which got triggered * for this event. Optional. */ int GuestBase::waitForEvent(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, VBoxEventType_T *pType, IEvent **ppEvent) { AssertPtrReturn(pEvent, VERR_INVALID_POINTER); /* pType is optional. */ /* ppEvent is optional. */ int vrc = pEvent->Wait(uTimeoutMS); if (RT_SUCCESS(vrc)) { const ComPtr<IEvent> pThisEvent = pEvent->Event(); if (!pThisEvent.isNull()) /* Having a VBoxEventType_ event is optional. */ { if (pType) { HRESULT hr = pThisEvent->COMGETTER(Type)(pType); if (FAILED(hr)) vrc = VERR_COM_UNEXPECTED; } if ( RT_SUCCESS(vrc) && ppEvent) pThisEvent.queryInterfaceTo(ppEvent); unconst(pThisEvent).setNull(); } } return vrc; }
/** * Initializes the machine debugger object. * * @returns COM result indicator * @param aParent handle of our parent object */ HRESULT MachineDebugger::init(Console *aParent) { LogFlowThisFunc(("aParent=%p\n", aParent)); ComAssertRet(aParent, E_INVALIDARG); /* Enclose the state transition NotReady->InInit->Ready */ AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); unconst(mParent) = aParent; for (unsigned i = 0; i < RT_ELEMENTS(maiQueuedEmExecPolicyParams); i++) maiQueuedEmExecPolicyParams[i] = UINT8_MAX; mSingleStepQueued = -1; mRecompileUserQueued = -1; mRecompileSupervisorQueued = -1; mPatmEnabledQueued = -1; mCsamEnabledQueued = -1; mLogEnabledQueued = -1; mVirtualTimeRateQueued = UINT32_MAX; mFlushMode = false; /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); return S_OK; }
/** * 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; }