Skip to content

Commit bc8c98d

Browse files
author
Adrian Steinhäuser
committed
Handle X11 errors during webview destruction on Linux to prevent crashes.
1 parent e401a5f commit bc8c98d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • wrywebview/src/main/rust

wrywebview/src/main/rust/lib.rs

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

980980
fn destroy_webview_inner(id: u64) -> Result<(), WebViewError> {
981981
wry_log!("[wrywebview] destroy_webview id={}", id);
982+
983+
#[cfg(target_os = "linux")]
984+
{
985+
gdk::error_trap_push();
986+
let res = unregister(id);
987+
while gtk::events_pending() {
988+
gtk::main_iteration_do(false);
989+
}
990+
let _ = gdk::error_trap_pop();
991+
res
992+
}
993+
994+
#[cfg(not(target_os = "linux"))]
982995
unregister(id)
983996
}
984997

0 commit comments

Comments
 (0)