Page MenuHomePhabricator

LiveWire crash if used in 3D - inconsistent interaction implementation in segmentation tools
Closed, ResolvedPublic

Description

Due to inconsistent implementation of the interaction concept in all of the segmentation tools there may arise situation where the segmentation tools cause MITK to crash.

The reason is that the CanHandleEvent function is used in order to determine whether an interaction event is suitable for the tool or not. However this check is done within the methods that implement the actions of the respective statemachine pattern of the tools, i.e. the state transition is already done at this point.
In case of the LiveWire to the check is done right at the beginning of OnInitLiveWire, which then returns due to a 3D interaction event which cannot be handled. However the transition was done and another action is executed. The crash happens then due to uninitialized LiveWireTool members.

Solution: Implement the FilterEvents function which is called before the state transition.
Remove all the CanHandleEvent calls.

Furthermore a lot dynamic_casts from InteractionEvent to InteractionPositionEvent can be removed.

Event Timeline

User fetzer has pushed new remote branch:

bug-18479-live-wire-crash

[6d68f2]: Merge branch 'bug-18479-live-wire-crash'

Merged commits:

2014-11-26 10:52:40 Andreas Fetzer [2bf1b3]
Fixed compile error


2014-11-26 10:38:33 Andreas Fetzer [c6606a]
Added check for valid member to avoid crash during tool stress tests.


2014-11-26 10:37:55 Andreas Fetzer [ab8f81]
Fixed crash in LiveWire tool

Added FilterEvents method to SegTool2D which is call by superclass mitkEventStateMachine.
Removed obsolete CanHandleEvent function.