Skip to content

Commit

Permalink
Fix not disposing callback in ResourceHandler.Skip (#3978)
Browse files Browse the repository at this point in the history
  • Loading branch information
chylex authored and amaitland committed Feb 10, 2022
1 parent bedccd2 commit 1663b19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CefSharp.Example/AcceptRangeResourceHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ private bool TryGetRangeHeader(out string contentRange, out int contentLength)

bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback)
{
//We don't need the callback, as it's an unmanaged resource we should dispose it (could wrap it in a using statement).
callback.Dispose();

//No Stream or Stream cannot seek then we indicate failure
if (stream == null || !stream.CanSeek)
{
Expand Down
3 changes: 3 additions & 0 deletions CefSharp/ResourceHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ bool IResourceHandler.Open(IRequest request, out bool handleRequest, ICallback c

bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback)
{
//We don't need the callback, as it's an unmanaged resource we should dispose it (could wrap it in a using statement).
callback.Dispose();

//No Stream or Stream cannot seek then we indicate failure
if (Stream == null || !Stream.CanSeek)
{
Expand Down

0 comments on commit 1663b19

Please sign in to comment.