Skip to content

Make multiple calls to FinalRelease safe #97059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 19, 2024

Conversation

jkoritzinsky
Copy link
Member

Fixes #96901

@ghost
Copy link

ghost commented Jan 17, 2024

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #96901

Author: jkoritzinsky
Assignees: -
Labels:

area-System.Runtime.InteropServices

Milestone: -

jkoritzinsky and others added 2 commits January 17, 2024 11:16
…e/InteropServices/Marshalling/ComObject.cs

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
@jkoritzinsky jkoritzinsky marked this pull request as ready for review January 17, 2024 22:39
@jkoritzinsky jkoritzinsky merged commit d030691 into dotnet:main Jan 19, 2024
@jkoritzinsky jkoritzinsky deleted the unique-release-safe branch January 19, 2024 01:54
tmds pushed a commit to tmds/runtime that referenced this pull request Jan 23, 2024
* Don't double-release a COM object

* Add a test

* Make the release thread-safe

* Add using

* Update src/libraries/System.Runtime.InteropServices/src/System/Runtime/InteropServices/Marshalling/ComObject.cs

Co-authored-by: Aaron Robinson <arobins@microsoft.com>

* Update src/libraries/System.Runtime.InteropServices/src/System/Runtime/InteropServices/Marshalling/ComObject.cs

* Update src/libraries/System.Runtime.InteropServices/src/System/Runtime/InteropServices/Marshalling/ComObject.cs

* Add name parameter

* Fix analyzer error

* SuppressFinalize earlier

* Add tests for the exceptional scenarios

---------

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Feb 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undefined behavior should not be invoked when a ComObject marshaled by UniqueComInterfaceMarshaller<T> is used after calling FinalRelease
3 participants