Skip to content

Commit

Permalink
fix: prevent memory leak on macOS, closes tauri-apps#536
Browse files Browse the repository at this point in the history
  • Loading branch information
keiya01 committed May 19, 2022
1 parent e11ad09 commit d5cdd30
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/webview/wkwebview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,15 +645,8 @@ 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);
let _: Id<_> = Id::from_ptr(self.manager);
let _: Id<_> = Id::from_retained_ptr(self.webview);
let _: Id<_> = Id::from_retained_ptr(self.manager);
}
}
}
Expand Down

0 comments on commit d5cdd30

Please sign in to comment.