Skip to content

Make multiple calls to FinalRelease safe#97059

Merged
jkoritzinsky merged 11 commits intodotnet:mainfrom
jkoritzinsky:unique-release-safe
Jan 19, 2024
Merged

Make multiple calls to FinalRelease safe#97059
jkoritzinsky merged 11 commits intodotnet:mainfrom
jkoritzinsky:unique-release-safe

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 <[email protected]>
@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 <[email protected]>

* 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 <[email protected]>
@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