Skip to content

Commit

Permalink
fix: set active before waiting for GUI update
Browse files Browse the repository at this point in the history
Signed-off-by: Enrico Stemmer <[email protected]>
  • Loading branch information
H3rmt committed Jan 7, 2025
1 parent dbfc1b2 commit 82a470e
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/daemon/handle_fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,17 @@ pub(crate) fn close(share: &Share, kill: bool) -> anyhow::Result<()> {
drop(lock);
}
deactivate_submap()?;
*(ACTIVE
.get()
.expect("ACTIVE not set")
.lock()
.expect("Failed to lock")) = false;

send.send_blocking(GUISend::Hide)
.context("Unable to refresh the GUI")?;
receive
.recv_blocking()
.context("Unable to receive GUI update")?;

*(ACTIVE
.get()
.expect("ACTIVE not set")
.lock()
.expect("Failed to lock")) = false;
clear_recent_clients();
thread::spawn(|| {
reload_desktop_maps();
Expand Down Expand Up @@ -120,17 +119,16 @@ pub(crate) fn init(share: &Share, config: Config, gui_config: GuiConfig) -> anyh
drop(lock);
}
activate_submap(gui_config.clone())?;
*(ACTIVE
.get()
.expect("ACTIVE not set")
.lock()
.expect("Failed to lock")) = true;

send.send_blocking(GUISend::New)
.context("Unable to refresh the GUI")?;
receive
.recv_blocking()
.context("Unable to receive GUI update")?;

*(ACTIVE
.get()
.expect("ACTIVE not set")
.lock()
.expect("Failed to lock")) = true;
Ok(())
}

0 comments on commit 82a470e

Please sign in to comment.