-
Notifications
You must be signed in to change notification settings - Fork 448
bug: FreehandRoiSculptorTool causing crash when disabled while no image loaded. #1303
Copy link
Copy link
Open
Description
Prerequisites
- Which version are you using? (Is it latest?)
- Latest but this applies from v4.19.1
- Are you reporting to the correct repository?
- Yes, sort of ... it's complicated
- Did you search existing issues? (Were any related?)
- Nope
Description
FreehandRoiSculptorTool can cause a crash if "disabled" before an image is loaded on an element. This case is especially likely to come up when globalToolSync is enabled.
This issue has become a problem for me since v4.19.1
The following change triggers the crash:
fc4495c#diff-8eec6cde9dbfd62a7f0ba3022495f20dR74-R82
This causes FreehandRoiSculptorTool to call updateImage on the element where we see the error.
cornerstoneTools/src/tools/FreehandRoiSculptorTool.js
Lines 834 to 850 in 79660e9
| _deactivateSculpt(element) { | |
| element.removeEventListener(EVENTS.MOUSE_UP, this.activeMouseUpCallback); | |
| element.removeEventListener(EVENTS.MOUSE_CLICK, this.activeMouseUpCallback); | |
| element.removeEventListener( | |
| EVENTS.MOUSE_DRAG, | |
| this.activeMouseDragCallback | |
| ); | |
| element.removeEventListener(EVENTS.TOUCH_END, this.activeTouchEndCallback); | |
| element.removeEventListener(EVENTS.TOUCH_TAP, this.activeTouchEndCallback); | |
| element.removeEventListener( | |
| EVENTS.TOUCH_DRAG, | |
| this.activeMouseDragCallback | |
| ); | |
| external.cornerstone.updateImage(element); | |
| } |
Steps to Reproduce the issue
The simplest test case is to add the FreehandRoiSculptorTool and then call setToolDisabledForElement for it.
CodeSandbox With Reproduction of Issue:
https://codesandbox.io/s/cornerstone-freehandsculptor-crash-u2wsk?file=/src/index.js
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels