SEBWIN-411: Fixed audio / video playback not stopping when closing additional browser window.

This commit is contained in:
Damian Büchel 2020-06-23 16:53:43 +02:00
parent c8b6aad877
commit 48d0dc4db6
3 changed files with 15 additions and 0 deletions

View file

@ -109,6 +109,7 @@ namespace SafeExamBrowser.Browser
internal void Terminate() internal void Terminate()
{ {
control.Destroy();
window.Close(); window.Close();
} }
@ -459,6 +460,7 @@ namespace SafeExamBrowser.Browser
private void Window_Closing() private void Window_Closing()
{ {
logger.Info($"Instance has terminated."); logger.Info($"Instance has terminated.");
control.Destroy();
Terminated?.Invoke(Id); Terminated?.Invoke(Id);
} }

View file

@ -74,6 +74,14 @@ namespace SafeExamBrowser.Browser
this.requestHandler = requestHandler; this.requestHandler = requestHandler;
} }
public void Destroy()
{
if (!IsDisposed)
{
Dispose(true);
}
}
public void Initialize() public void Initialize()
{ {
AddressChanged += (o, args) => addressChanged?.Invoke(args.Address); AddressChanged += (o, args) => addressChanged?.Invoke(args.Address);

View file

@ -51,6 +51,11 @@ namespace SafeExamBrowser.UserInterface.Contracts.Browser
/// </summary> /// </summary>
event TitleChangedEventHandler TitleChanged; event TitleChangedEventHandler TitleChanged;
/// <summary>
/// Finalizes the browser control (e.g. stops audio / video playback) and releases all used resources.
/// </summary>
void Destroy();
/// <summary> /// <summary>
/// Initializes the browser control. /// Initializes the browser control.
/// </summary> /// </summary>