Skip to content

Commit

Permalink
Add using(callback) so dispose is called in the event of an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
amaitland committed Sep 9, 2015
1 parent 979d3fb commit 00e9bdd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions CefSharp.Example/CefSharpSchemeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@ public bool ProcessRequestAsync(IRequest request, ICallback callback)
{
Task.Run(() =>
{
var bytes = Encoding.UTF8.GetBytes(resource);
stream = new MemoryStream(bytes);
using (callback)
{
var bytes = Encoding.UTF8.GetBytes(resource);
stream = new MemoryStream(bytes);

var fileExtension = Path.GetExtension(fileName);
mimeType = ResourceHandler.GetMimeType(fileExtension);
var fileExtension = Path.GetExtension(fileName);
mimeType = ResourceHandler.GetMimeType(fileExtension);

callback.Continue();
callback.Continue();
}
});

return true;
Expand Down

0 comments on commit 00e9bdd

Please sign in to comment.