/** * Initializes the object given another 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 VRDEServer::init(Machine *aParent, VRDEServer *aThat) { syslog(LOG_ERR, "-----------VRDE Server init-02---------------------"); if (aThat->mData.isNull()) { syslog(LOG_ERR, "----xxx-------VRDE Server init aThat is null---------------------"); // mData.allocate(); // mData->fEnabled = false; } if (mData.isNull()) { syslog(LOG_ERR, "----xxx-------VRDE Server init mData is null---------------------"); } 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; unconst(mPeer) = aThat; AutoCaller thatCaller(aThat); AssertComRCReturnRC(thatCaller.hrc()); AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS); mData.share(aThat->mData); if (mData.isNull()) { syslog(LOG_ERR, "----xxx-------VRDE Server Init -- mData is Null---------------------"); // mData.allocate(); // mData->fEnabled = false; } /* Confirm a successful initialization */ autoInitSpan.setSucceeded(); syslog(LOG_ERR, "-----------VRDE Server init-03---------------------"); return S_OK; }