You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix SafeHandle usage in System.IO.Compression #89445
Discovered while fixing #86960. System.IO.Compression doesn't seem to utilize SafeHandle properly to have ref counts working during interop. See Stephen's comment below
I took a peek. I'm a little disheartened, not by your change, but by how SafeHandle is being used today in System.IO.Compression. It's not really being used how it's intended to be used. It's not storing a pointer to the data that's actually being used by the native code, so the SafeHandle isn't itself being passed through the LibraryImports, which means it's not being ref counted via DangerousAdd/Release the way it's meant to be as part of P/Invokes. As such, using DangerousAdd/Release here isn't necessarily achieving the goal.
We might want to revert "temporarily" to your previous workaround, and then separately overhaul how SafeHandle is used by all of this code.
Activity
Reliable clean-up of SafeHandles in Deflater/Inflater (dotnet#114826)