From 63e2399266157204216f479e3476adfca6838715 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 24 Dec 2019 12:27:21 +0100 Subject: Fix: Drop habit before getting instances Because when showing an instance, we try to get the comment for the instance from the habit template, which tries to Store::get() the template in HabitInstance::get_comment(). This fails if the template is already borrowed, thus drop the borrow before the whole thing. Signed-off-by: Matthias Beyer (cherry picked from commit 0cac7ec15774f8381e2c260e37754e17788875f2) --- bin/domain/imag-habit/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/domain/imag-habit/src/lib.rs b/bin/domain/imag-habit/src/lib.rs index 96d88f01..4350b20e 100644 --- a/bin/domain/imag-habit/src/lib.rs +++ b/bin/domain/imag-habit/src/lib.rs @@ -514,7 +514,9 @@ fn show(rt: &Runtime) -> Result<()> { let mut j = 0; let mut empty = true; - habit.linked_instances()? + let instances = habit.linked_instances()?; + drop(habit); + instances .into_get_iter(rt.store()) .map_inner_ok_or_else(|| err_msg("Did not find one habit template")) .and_then_ok(|e| { -- cgit v1.2.3