Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

template<class C>
HRESULT ComObjPtr< C >::createObject (  )  [inline]

Creates a new server-side object of the given component class and immediately starts to manage a pointer to the created object (the previous pointer, if any, is of course released when appropriate).

Note:
This method should be used with care on weakly referenced smart pointers because it leaves the newly created object completely unreferenced (i.e., with reference count equal to zero),

Win32: when VBOX_COM_OUTOFPROC_MODULE is defined, the created object doesn't increase the lock count of the server module, as it does otherwise.

Definition at line 520 of file ptr.h.

Referenced by SessionMachine::BeginTakingSnapshot(), Medium::createDiffStorage(), Console::CreateSharedFolder(), SessionMachine::DeleteSnapshot(), Medium::deleteStorage(), com::VirtualBoxErrorInfoGlue::init(), SessionMachine::init(), Medium::init(), SnapshotMachine::init(), Console::loadStateFileExecInternal(), Medium::mergeTo(), NetworkInterfaces(), Progress::notifyCompleteV(), Console::powerUp(), Console::processRemoteUSBDevices(), SessionMachine::RestoreSnapshot(), VirtualBoxSupportErrorInfoImplBase::setErrorInternal(), and com::SupportErrorInfoBase::setErrorInternal().

    {
        HRESULT rc;
#if !defined (VBOX_WITH_XPCOM)
#   ifdef VBOX_COM_OUTOFPROC_MODULE
        CComObjectNoLock<C> *obj = new CComObjectNoLock<C>();
        if (obj)
        {
            obj->InternalFinalConstructAddRef();
            rc = obj->FinalConstruct();
            obj->InternalFinalConstructRelease();
        }
        else
            rc = E_OUTOFMEMORY;
#   else
        CComObject<C> *obj = NULL;
        rc = CComObject<C>::CreateInstance(&obj);
#   endif
#else /* !defined (VBOX_WITH_XPCOM) */
        CComObject<C> *obj = new CComObject<C>();
        if (obj)
            rc = obj->FinalConstruct();
        else
            rc = E_OUTOFMEMORY;
#endif /* !defined (VBOX_WITH_XPCOM) */
        *this = obj;
        return rc;
    }


Generated by  Doxygen 1.6.0   Back to index