From fc9ac6cac71fc69703cea3458afbc23b5f933b45 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Mon, 7 Aug 2023 21:46:50 +0200 Subject: [PATCH] list nav: fix deadlock in goby() horizontal case --- nested/src/editors/list/nav.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nested/src/editors/list/nav.rs b/nested/src/editors/list/nav.rs index 00966c0..157a479 100644 --- a/nested/src/editors/list/nav.rs +++ b/nested/src/editors/list/nav.rs @@ -249,10 +249,15 @@ impl TreeNav for ListEditor { // nested if cur.tree_addr[0] < self.data.len() as isize { - match self.data - .get_mut(cur.tree_addr[0] as usize) - .write().unwrap() - .goby(direction) + + let cur_item = self.data + .get_mut(cur.tree_addr[0] as usize); + + let result = cur_item.write().unwrap().goby(direction); + + drop(cur_item); + + match result { TreeNavResult::Exit => { if direction.y < 0 {