Skip to content

Commit

Permalink
fix(macos): clear_all_browsing_data segfault with null completionHand…
Browse files Browse the repository at this point in the history
…ler (#1362)

* fix(macos): clear_all_browsing_data segfault with null completionHandler

the completionHandler cannot be null: https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532936-removedata

* simplify closure
  • Loading branch information
lucasfernog authored Sep 20, 2024
1 parent ba5b1e0 commit 5111eb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-clear-browsing-data-macos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Fixes `WebView::clear_all_browsing_data` crashing with a segfault on macOS.
2 changes: 1 addition & 1 deletion src/wkwebview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ r#"Object.defineProperty(window, 'ipc', {
let store: id = msg_send![config, websiteDataStore];
let all_data_types: id = msg_send![class!(WKWebsiteDataStore), allWebsiteDataTypes];
let date: id = msg_send![class!(NSDate), dateWithTimeIntervalSince1970: 0.0];
let handler = null::<*const c_void>();
let handler = block::ConcreteBlock::new(|| {}).copy();
let _: () = msg_send![store, removeDataOfTypes:all_data_types modifiedSince:date completionHandler:handler];
}
Ok(())
Expand Down

0 comments on commit 5111eb0

Please sign in to comment.