ResourceHandler - Add AutoDisposeStream (Stream will be disposed when the ResourceHandler is Disposed)

This commit is contained in:
amaitland
2016-06-01 15:09:58 +10:00
parent 824c34f5d3
commit e97fe18165
+12 -1
View File
@@ -67,6 +67,13 @@ namespace CefSharp
/// </summary>
public ResourceHandlerType Type { get; private set; }
/// <summary>
/// When true the Stream will be Disposed when
/// this instance is Disposed. The default value for
/// this property is false.
/// </summary>
public bool AutoDisposeStream { get; set; }
/// <summary>
/// Default Constructor
/// </summary>
@@ -877,7 +884,11 @@ namespace CefSharp
/// </summary>
public virtual void Dispose()
{
if(AutoDisposeStream && Steam != null)
{
Stream.Dispose();
Stream = null;
}
}
}
}