From aeb7e7cd7c658e7f68c8dd1d1a980cd6f5f21795 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 26 Mar 2019 15:53:02 +0100 Subject: [PATCH] sculpt manager: prevent double destruction The '_currently_constructed' pointer caches the information about which 'Launched_child' is currently configured in the menu. When discarding the runtime (e.g., when un-using a file system) at this point, this cached pointer was not invalidated while all 'Launched_child' objects would be freed (including the currently constructed one). On the next attempt to construct a new child, the sculpt manager attempted to destruct the 'Launched_child' referred by the (now outdated) '_currently_constructed' again. Fixes #3240 --- repos/gems/src/app/sculpt_manager/model/runtime_state.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repos/gems/src/app/sculpt_manager/model/runtime_state.h b/repos/gems/src/app/sculpt_manager/model/runtime_state.h index 0fa978f3d8..5c6e9119ac 100644 --- a/repos/gems/src/app/sculpt_manager/model/runtime_state.h +++ b/repos/gems/src/app/sculpt_manager/model/runtime_state.h @@ -396,6 +396,12 @@ class Sculpt::Runtime_state : public Runtime_info void reset_abandoned_and_launched_children() { + /* + * Invalidate '_currently_constructed' pointer, which may point + * to a to-be-destructed 'Launched_child'. + */ + discard_construction(); + _abandoned_children.for_each([&] (Abandoned_child &child) { destroy(_alloc, &child); });