Skip to content

Commit ebfdfe4

Browse files
authored
Merge pull request #28 from zaroxh/main
Handle X11 errors during webview destruction on Linux to prevent crashes.
2 parents 6e0049d + 82a9c47 commit ebfdfe4

File tree

1 file changed

+13
-0
lines changed
  • wrywebview/src/main/rust

1 file changed

+13
-0
lines changed

wrywebview/src/main/rust/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,19 @@ pub fn close_dev_tools(id: u64) -> Result<(), WebViewError> {
998998

999999
fn destroy_webview_inner(id: u64) -> Result<(), WebViewError> {
10001000
wry_log!("[wrywebview] destroy_webview id={}", id);
1001+
1002+
#[cfg(target_os = "linux")]
1003+
{
1004+
gdk::error_trap_push();
1005+
let res = unregister(id);
1006+
while gtk::events_pending() {
1007+
gtk::main_iteration_do(false);
1008+
}
1009+
let _ = gdk::error_trap_pop();
1010+
res
1011+
}
1012+
1013+
#[cfg(not(target_os = "linux"))]
10011014
unregister(id)
10021015
}
10031016

0 commit comments

Comments
 (0)