Skip to content

Make deinitialize unsafe - #97

Merged
HEnquist merged 1 commit into
masterfrom
unsafe-deinitialize
Nov 23, 2026
Merged

HEnquist merged 1 commit into
masterfrom
unsafe-deinitialize

Conversation

@HEnquist

Copy link
Copy Markdown
Owner

Make deinitialize unsafe, see #96.

  • deinitialize is now unsafe, with a Safety section: calls must be balanced, and objects from the crate must be dropped before COM is closed.
  • The docs of initialize_mta, initialize_sta and deinitialize say that managing COM is up to the application, and link to the Microsoft docs.

Calling deinitialize while objects from the crate are still alive can
tear down the apartment and unload the libraries behind them, so safe
code could reach undefined behaviour. It is now unsafe with a Safety
section.

The docs of all three COM helpers now say that managing COM is up to the
application, and link to the relevant Microsoft documentation.

See #96.
@HEnquist
HEnquist merged commit 45aa5e0 into master Nov 23, 2026
3 checks passed
@HEnquist HEnquist mentioned this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant