Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/DTF/Libraries/Compression.Cab/CabPacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,11 @@ protected override void Dispose(bool disposing)
{
try
{
if (disposing)
// See comment in CabUnpacker.Dispose for more info.
if (this.fciHandle != null)
{
if (this.fciHandle != null)
{
this.fciHandle.Dispose();
this.fciHandle = null;
}
this.fciHandle.Dispose();
this.fciHandle = null;
}
}
finally
Expand Down
14 changes: 8 additions & 6 deletions src/DTF/Libraries/Compression.Cab/CabUnpacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,15 @@ protected override void Dispose(bool disposing)
{
try
{
if (disposing)
// While fdiHandle is a SafeHandle, it will callback to C# method from this instance
// when releasing handle, and since finalizers execute in nondeterministic order, if
// the handle's finalizer runs after this instance, it will get exception and crash
// the process. Therefore we must release this handle regardless of the 'disposing'
// flag.
if (this.fdiHandle != null)
{
if (this.fdiHandle != null)
{
this.fdiHandle.Dispose();
this.fdiHandle = null;
}
this.fdiHandle.Dispose();
this.fdiHandle = null;
}
}
finally
Expand Down