diff --git a/src/ui/cm.rs b/src/ui/cm.rs index cb6ebc171..5d019a760 100644 --- a/src/ui/cm.rs +++ b/src/ui/cm.rs @@ -94,6 +94,9 @@ impl ConnectionManager { fn remove_connection(&self, id: i32) { self.write().unwrap().senders.remove(&id); + if self.read().unwrap().senders.len() == 0 { + std::process::exit(0); + } self.call("removeConnection", &make_args!(id)); } @@ -315,10 +318,6 @@ impl ConnectionManager { } } - fn exit(&self) { - std::process::exit(0); - } - fn t(&self, name: String) -> String { crate::client::translate(name) } @@ -336,7 +335,6 @@ impl sciter::EventHandler for ConnectionManager { fn authorize(i32); fn switch_permission(i32, String, bool); fn send_msg(i32, String); - fn exit(); } } diff --git a/src/ui/cm.tis b/src/ui/cm.tis index 7e81a79d7..81ace88b6 100644 --- a/src/ui/cm.tis +++ b/src/ui/cm.tis @@ -296,9 +296,7 @@ handler.removeConnection = function(id) { }); if (i < 0) return; connections.splice(i, 1); - if (connections.length == 0) { - handler.exit(); - } else { + if (connections.length > 0) { if (body.cur >= i && body.cur > 0) body.cur -= 1; update(); }