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. ///