Skip to content

Commit

Permalink
Fixed bug when changing URL in webkitgtk.
Browse files Browse the repository at this point in the history
  • Loading branch information
bamidev committed Feb 26, 2024
1 parent cc775c5 commit e9dea53
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/browser_window/webkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
collections::HashMap,
ptr,
sync::{
atomic::{AtomicPtr, Ordering},
atomic::{AtomicBool, AtomicPtr, Ordering},
Arc,
},
};
Expand Down Expand Up @@ -140,6 +140,7 @@ impl BrowserWindowExt for BrowserWindowImpl {
// FIXME: We need to call creation_callback, but pass an error to it, if the web
// view can not be loaded correctly. Now we risk never notifying the
// future that is waiting on us.
let mut created = AtomicBool::new(false);
inner.connect_load_changed(move |i, e| {
if e == LoadEvent::Finished {
// Create the global JS function `invoke_extern`
Expand All @@ -157,7 +158,9 @@ impl BrowserWindowExt for BrowserWindowImpl {
},
);

creation_callback(this.clone(), callback_data);
if !created.swap(true, Ordering::Relaxed) {
creation_callback(this.clone(), callback_data);
}
}
});
}
Expand Down

0 comments on commit e9dea53

Please sign in to comment.