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
This commit is contained in:
Norman Feske 2019-03-26 15:53:02 +01:00
parent 935abb55b7
commit aeb7e7cd7c

View File

@ -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); });