Page MenuHomePhabricator

Create (smoothed) polygon model crashes
Closed, ResolvedPublic

Description

Creating a (smoothed) polygon model from a segmentation crashes due to a recursive destructor call of mitk::NonBlockingAlgorithm.

The issue occurs since ITK threading was replaced with Standard Library Threading in mitk::NonBlockingAlgorithm and it also uncovered a race condition since a smart pointer to itself is passed to the thread that is in turn a member of the class. Without changing the class design fundamentally, we (1) have to make sure that the method that spawns the thread does not end before the thread execution actually starts, since the reference counter would decrease to 0, and (2) have to disconnect from the thread in the destructor instead of trying to join the thread.

To resolve (1) without blocking, we can facilitate the reference count and increase it manually before spawning the thread and make sure to decrease it on both exit possibilities of the thread.