From c16e324a1723162b22a85bc4b4c437b342dd0f04 Mon Sep 17 00:00:00 2001 From: udit3333 Date: Thu, 5 Mar 2020 10:21:50 -0800 Subject: [PATCH] Call GC on preview unloading (#1456) * Call GC collect on preview unloading * Added github issue link --- .../previewpane/common/controls/FormHandlerControl.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/previewpane/common/controls/FormHandlerControl.cs b/src/modules/previewpane/common/controls/FormHandlerControl.cs index 642bc094fe8d..7c5de795746a 100644 --- a/src/modules/previewpane/common/controls/FormHandlerControl.cs +++ b/src/modules/previewpane/common/controls/FormHandlerControl.cs @@ -111,6 +111,12 @@ public virtual void Unload() this.Controls.Clear(); }); + + // Call garbage collection at the time of unloading of Preview. This is to mitigate issue with WebBrowser Control not able to dispose properly. + // Which is preventing prevhost.exe to exit at the time of closing File explorer. + // Preview Handlers run in a separate process from PowerToys. This will not affect the performance of other modules. + // Mitigate the following Github issue: https://github.com/microsoft/PowerToys/issues/1468 + GC.Collect(); } ///