Alexander Nickolov <agnickolov@mvps.org> wrote:
I don't think it would when embedded in a struct with no
copy constructor and assignment operator redefined.
A missing copy constructor is not a problem - the compiler would provide
one that does the right thing. Are you perhaps thinking about default
constructor?
What assignment operator? I don't see any in the OP's code. Am I missing
something obvious?
These
need to be added since the defaults do shallow copies thus
leading to double destruction.
Compiler-generated copy constructor would call CComPtr's copy constructor,
which would perform AddRef appropriately. The same with assignment
operator.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925