Fix COM ref counting in SOSMethodEnum simulator#5746
Merged
hoyosjs merged 1 commit intodotnet:mainfrom Mar 5, 2026
Merged
Conversation
c439149 to
65effde
Compare
65effde to
7f23d51
Compare
…_CHANGE_VERSION - Bump SOS_BREAKING_CHANGE_VERSION from 5 to 6 to match runtime. - Fix SOSMethodEnum simulator to use standard COM ref counting: initialize refCount to 0 and use QueryInterface to return the interface pointer with a proper AddRef. - Fix ISOSMethodEnum leak in DumpMT by using ToRelease<>. Matching PR: dotnet/runtime#125231 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7f23d51 to
0f3b0c8
Compare
hoyosjs
approved these changes
Mar 5, 2026
Member
|
This change doesn't change behavior at all. It would be nice to reclaim resources but we haven't gotten reports. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Matching PR for dotnet/runtime#125231, which fixes
DefaultCOMImpl::Release()reference counting bugs in the DAC.Changes
1. Fix
SOSMethodEnumsimulator COM ref counting (util.cpp)The
SOSDacInterface15simulator'sGetMethodTableSlotEnumeratorhad the same bug pattern fixed in the runtime PR — raw pointer assignment withoutQueryInterface, and the null check occurred after the dereference. Fixed to:refCountto 0 (matchingDefaultCOMImplconvention)QueryInterfaceto return the interface, properly callingAddRefdeleteon failure (sinceQueryInterfacewasn't called at refCount 0)2. Fix
ISOSMethodEnumleak instrike.cppChanged raw
ISOSMethodEnum*toToRelease<ISOSMethodEnum>soRelease()is called when the pointer goes out of scope, matching the pattern used everywhere else (e.g.,ToRelease<ISOSHandleEnum>).