c++ - If pointer of a COM interface assigned to a CComPtr object do I need to Release the original one? -
if create pointer of com interface , assign object of ccomptr
of same com interface need release original com pointer?
isomecominterface* psomecominterface = new csomecominterfaceimplemented(); ccomptr<isomecominterface> cptrsomecominterface = psomecominterface; // .... // need release original com pointer. psomecominterface->release();
ccomptr
takes care of reference count of internal interface pointer, managed instance of class. has no effect on reference counts of other pointers. is, having assigned pointer variable, can sure ccomptr
's internal pointer addref
'ded , release
'd necessary, should take care of raw interface pointer variable psomecominterface
, make explicit release
call.
Comments
Post a Comment