Skip to content

Commit

Permalink
fix: reset background process when webview is closed, closes #536 (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
keiya01 committed Apr 24, 2022
1 parent 76f18e0 commit fd1dcc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/stop-background-process.md
@@ -0,0 +1,5 @@
---
"wry": patch
---

Fix to reset process on MacOS when webview is closed, closes #536.
5 changes: 5 additions & 0 deletions src/webview/wkwebview/mod.rs
Expand Up @@ -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);
Expand Down

0 comments on commit fd1dcc3

Please sign in to comment.