Fix race condition in tauri and window not navigating in release mode

This commit is contained in:
Patrick Pacher
2024-03-27 12:52:52 +01:00
parent 3c0a362bff
commit 347e2d1982
5 changed files with 50 additions and 18 deletions

View File

@@ -38,7 +38,13 @@ struct WsHandler {
}
impl portmaster::Handler for WsHandler {
fn name(&self) -> String {
"main-handler".to_string()
}
fn on_connect(&mut self, cli: portapi::client::PortAPI) -> () {
info!("connection established, creating main window");
// we successfully connected to Portmaster. Set is_first_connect to false
// so we don't show the splash-screen when we loose connection.
self.is_first_connect = false;
@@ -52,6 +58,8 @@ impl portmaster::Handler for WsHandler {
// bootstrapping.
if let Err(err) = create_main_window(&self.handle) {
error!("failed to create main window: {}", err.to_string());
} else {
debug!("created main window")
}
let handle = self.handle.clone();