HEnquist / wasapi-rs

Simple Wasapi bindings for Rust
MIT License
43 stars 11 forks source link

Add `fn deinitialize()` utilizing `CoUninitialize` #19

Closed rosingrind closed 11 months ago

rosingrind commented 1 year ago

As stated in docs:

To close the COM library gracefully on a thread, each successful call to CoInitialize or CoInitializeEx, including any call that returns S_FALSE, must be balanced by a corresponding call to CoUninitialize

I'm not really familiar with the wasapi crate development direction, but I think there should be a function such as fn deinitialize() for these safety purposes. What's your opinion?

https://github.com/HEnquist/wasapi-rs/blob/bf15059518796e19ee3d8a8e1d6d9fb096d37d7b/src/api.rs#L61-L68

HEnquist commented 1 year ago

Thanks, this is a good suggestion. I'll include it in the next version.

HEnquist commented 11 months ago

Added in https://github.com/HEnquist/wasapi-rs/commit/2613e9797280ff082f2d786abb2454faf31aab87