From 48d0dc4db6fde6d5f4224ce3ef47b665870c6a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Tue, 23 Jun 2020 16:53:43 +0200 Subject: [PATCH] SEBWIN-411: Fixed audio / video playback not stopping when closing additional browser window. --- SafeExamBrowser.Browser/BrowserApplicationInstance.cs | 2 ++ SafeExamBrowser.Browser/BrowserControl.cs | 8 ++++++++ .../Browser/IBrowserControl.cs | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/SafeExamBrowser.Browser/BrowserApplicationInstance.cs b/SafeExamBrowser.Browser/BrowserApplicationInstance.cs index e792bfb0..4b2b5265 100644 --- a/SafeExamBrowser.Browser/BrowserApplicationInstance.cs +++ b/SafeExamBrowser.Browser/BrowserApplicationInstance.cs @@ -109,6 +109,7 @@ namespace SafeExamBrowser.Browser internal void Terminate() { + control.Destroy(); window.Close(); } @@ -459,6 +460,7 @@ namespace SafeExamBrowser.Browser private void Window_Closing() { logger.Info($"Instance has terminated."); + control.Destroy(); Terminated?.Invoke(Id); } diff --git a/SafeExamBrowser.Browser/BrowserControl.cs b/SafeExamBrowser.Browser/BrowserControl.cs index 1d5dd331..b547a291 100644 --- a/SafeExamBrowser.Browser/BrowserControl.cs +++ b/SafeExamBrowser.Browser/BrowserControl.cs @@ -74,6 +74,14 @@ namespace SafeExamBrowser.Browser this.requestHandler = requestHandler; } + public void Destroy() + { + if (!IsDisposed) + { + Dispose(true); + } + } + public void Initialize() { AddressChanged += (o, args) => addressChanged?.Invoke(args.Address); diff --git a/SafeExamBrowser.UserInterface.Contracts/Browser/IBrowserControl.cs b/SafeExamBrowser.UserInterface.Contracts/Browser/IBrowserControl.cs index 8259bcde..db38bdc3 100644 --- a/SafeExamBrowser.UserInterface.Contracts/Browser/IBrowserControl.cs +++ b/SafeExamBrowser.UserInterface.Contracts/Browser/IBrowserControl.cs @@ -51,6 +51,11 @@ namespace SafeExamBrowser.UserInterface.Contracts.Browser /// event TitleChangedEventHandler TitleChanged; + /// + /// Finalizes the browser control (e.g. stops audio / video playback) and releases all used resources. + /// + void Destroy(); + /// /// Initializes the browser control. ///