[release/9.0] Ensure proper ref count of underlying ocx #12287
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #12281 to release/9.0
/cc @lonitra
Customer Impact
Upon doing improvements to our interop code, we had missed releasing a pointer to the underlying ocx of the AxHost control, which was causing the underlying ocx to linger even after customer AxHost control is disposed. This causes the destructor of the of the underlying ocx to not get called because it still has a ref count of 1, causing issues with resource management in their application.
Testing
Tested manually with customer repro scenario and added regression test for the scenario.
Risk
Low. Change involves releasing the pointer we missed, correcting the ref count.
Microsoft Reviewers: Open in CodeFlow