diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-12-24 12:27:21 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-12-25 13:45:54 +0100 |
commit | 63e2399266157204216f479e3476adfca6838715 (patch) | |
tree | 6fd7a4a313fc75f9a835bea8c254fe2819b7a544 | |
parent | 343a409df938d3fb9197b5aa8f7d551b1a8dd151 (diff) |
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 <mail@beyermatthias.de>
(cherry picked from commit 0cac7ec15774f8381e2c260e37754e17788875f2)
-rw-r--r-- | bin/domain/imag-habit/src/lib.rs | 4 |
1 files changed, 3 insertions, 1 deletions
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| { |