I am running into errors on dtor’s of for instance the Parameter Change (validtor.exe) tests.
This code in automation.cpp
(line 103)
paramChanges = new ParamChanges[numParams];
and later (line 149)
delete[] paramChanges;
is not correct.
You can never allocate ‘COM’ objects in an array like that - or destroy them that way.
You have to use the reference counting mechanism.
So allocation should be done on individual basis and destruction is a matter of calling release()
(and clearing your member var to indicate that).
I am somewhat concerned that this code is in here after all this time. That either means not many people use these tests or they are doing it wrong…??
I also want to suggest to add a DEBUG
implementation for FUNKNOWN_DTOR
that asserts its __refcount.