Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: FreehandRoiSculptorTool causing crash when disabled while no image loaded. #1303

Open
3 tasks done
mikehazell opened this issue Sep 1, 2020 · 0 comments
Open
3 tasks done

Comments

@mikehazell
Copy link
Contributor

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.

_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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant