fix toggle clipboard dead lock

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-02-23 14:43:41 +08:00
parent 9f062b8bb6
commit 30840f9988
2 changed files with 8 additions and 7 deletions

View File

@ -1241,11 +1241,6 @@ impl LoginConfigHandler {
if !name.contains("block-input") {
self.save_config(config);
}
#[cfg(feature = "flutter")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if name == "disable-clipboard" {
crate::flutter::update_text_clipboard_required();
}
let mut misc = Misc::new();
misc.set_option(option);
let mut msg_out = Message::new();

View File

@ -165,9 +165,15 @@ pub fn session_reconnect(id: String, force_relay: bool) {
}
pub fn session_toggle_option(id: String, value: String) {
let mut is_found = false;
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
log::warn!("toggle option {}", value);
session.toggle_option(value);
is_found = true;
log::warn!("toggle option {}", &value);
session.toggle_option(value.clone());
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if is_found && value == "disable-clipboard" {
crate::flutter::update_text_clipboard_required();
}
}