From fd1dcc3cc5a290bfe4ae8de04064074109902432 Mon Sep 17 00:00:00 2001 From: keiya sasaki <34934510+keiya01@users.noreply.github.com> Date: Sun, 24 Apr 2022 12:48:26 +0000 Subject: [PATCH] fix: reset background process when webview is closed, closes #536 (#556) --- .changes/stop-background-process.md | 5 +++++ src/webview/wkwebview/mod.rs | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changes/stop-background-process.md diff --git a/.changes/stop-background-process.md b/.changes/stop-background-process.md new file mode 100644 index 000000000..60eb3fedc --- /dev/null +++ b/.changes/stop-background-process.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Fix to reset process on MacOS when webview is closed, closes #536. diff --git a/src/webview/wkwebview/mod.rs b/src/webview/wkwebview/mod.rs index 5ea4529a6..85e69c1dd 100644 --- a/src/webview/wkwebview/mod.rs +++ b/src/webview/wkwebview/mod.rs @@ -621,6 +621,11 @@ impl Drop for InnerWebView { } } + // WKWebview has a single WKProcessPool to manage web contents. + // The WKProcessPool is not reset even if WKWebview is deallocated. + // So we need to override the process by navigating to `about:blank`. + self.navigate("about:blank"); + let _: Id<_> = Id::from_ptr(self.webview); #[cfg(target_os = "macos")] let _: Id<_> = Id::from_ptr(self.ns_window);