Prerequisites
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.
|
_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
Prerequisites
Description
FreehandRoiSculptorToolcan cause a crash if "disabled" before an image is loaded on an element. This case is especially likely to come up whenglobalToolSyncis enabled.This issue has become a problem for me since
v4.19.1The following change triggers the crash:
fc4495c#diff-8eec6cde9dbfd62a7f0ba3022495f20dR74-R82
This causes
FreehandRoiSculptorToolto callupdateImageon the element where we see the error.cornerstoneTools/src/tools/FreehandRoiSculptorTool.js
Lines 834 to 850 in 79660e9
Steps to Reproduce the issue
The simplest test case is to add the
FreehandRoiSculptorTooland then callsetToolDisabledForElementfor it.CodeSandbox With Reproduction of Issue:
https://codesandbox.io/s/cornerstone-freehandsculptor-crash-u2wsk?file=/src/index.js