Fix :q panic
This commit is contained in:
parent
54fd5775e9
commit
9f17a8bb09
@ -69,9 +69,7 @@ impl NeovimClientAsync {
|
|||||||
|
|
||||||
impl Clone for NeovimClientAsync {
|
impl Clone for NeovimClientAsync {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
NeovimClientAsync {
|
NeovimClientAsync { nvim: self.nvim.clone() }
|
||||||
nvim: self.nvim.clone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,11 +88,17 @@ impl NeovimClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn clear(&self) {
|
||||||
|
let mut nvim = self.nvim.borrow_mut();
|
||||||
|
if nvim.is_some() {
|
||||||
|
nvim.take();
|
||||||
|
} else {
|
||||||
|
self.nvim_async.nvim.lock().unwrap().take();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn async_to_sync(&self) {
|
pub fn async_to_sync(&self) {
|
||||||
let mut lock = self.nvim_async
|
let mut lock = self.nvim_async.nvim.lock().unwrap();
|
||||||
.nvim
|
|
||||||
.lock()
|
|
||||||
.unwrap();
|
|
||||||
let nvim = lock.take().unwrap();
|
let nvim = lock.take().unwrap();
|
||||||
*self.nvim.borrow_mut() = Some(nvim);
|
*self.nvim.borrow_mut() = Some(nvim);
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,14 @@ fn init_nvim_async(
|
|||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
guard.join().expect("Can't join dispatch thread");
|
guard.join().expect("Can't join dispatch thread");
|
||||||
|
|
||||||
idle_cb_call!(state_ref.detach_cb());
|
glib::idle_add(move || {
|
||||||
|
state_ref.borrow().nvim.clear();
|
||||||
|
if let Some(ref cb) = state_ref.borrow().detach_cb {
|
||||||
|
(&mut *cb.borrow_mut())();
|
||||||
|
}
|
||||||
|
|
||||||
|
glib::Continue(false)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// attach ui
|
// attach ui
|
||||||
|
Loading…
Reference in New Issue
Block a user