Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mdaneri committed Nov 29, 2024
1 parent 391bdff commit c7490f8
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 199 deletions.
51 changes: 40 additions & 11 deletions src/Listener/PodeHttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -412,22 +412,51 @@ public override void PartialDispose()
base.PartialDispose();
}

public override void Dispose()
/* public override void Dispose()
{
RawBody = default;
_body = string.Empty;
if (BodyStream != default(MemoryStream))
{
BodyStream.Dispose();
}
if (Form != default(PodeForm))
{
Form.Dispose();
}
base.Dispose();
}*/

/// <summary>
/// Dispose managed and unmanaged resources.
/// </summary>
/// <param name="disposing">Indicates whether the method is called explicitly or by garbage collection.</param>
protected override void Dispose(bool disposing)
{
RawBody = default;
_body = string.Empty;

if (BodyStream != default(MemoryStream))
if (disposing)
{
BodyStream.Dispose();
}
// Custom cleanup logic for PodeHttpRequest
RawBody = default;
_body = string.Empty;

if (Form != default(PodeForm))
{
Form.Dispose();
if (BodyStream != null)
{
BodyStream.Dispose();
BodyStream = null;
}

if (Form != null)
{
Form.Dispose();
Form = null;
}
}

base.Dispose();
// Call the base Dispose to clean up shared resources
base.Dispose(disposing);
}
}
}
Loading

0 comments on commit c7490f8

Please sign in to comment.