You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling any of the setToolMode methods too many time with options of { mouseButtonMask: 1 } will eventually cause the app to crash with a "RangeError: Invalid array length" error.
// Keep the same if not an array (undefined)// Reset if empty array// Merge if array contains any bindingsif(Array.isArray(options.mouseButtonMask)&&options.mouseButtonMask.length!==0&&Array.isArray(tool.options.mouseButtonMask)){options.mouseButtonMask=options.mouseButtonMask.concat(tool.options.mouseButtonMask);}
The code here is concatenating the mouseButtonMask array but not removing duplicates.
I'll create a PR shortly with tests showing the issue and a fix.
The text was updated successfully, but these errors were encountered:
…rray on a tool
Fixes a bug where the app can have poor performance or even crash when setToolModeForElement is
called too many times.
cornerstonejs#898
Prerequisites
Description
Bug
Calling any of the
setToolMode
methods too many time with options of{ mouseButtonMask: 1 }
will eventually cause the app to crash with a "RangeError: Invalid array length" error.This is happening this line: https://github.com/cornerstonejs/cornerstoneTools/blob/master/src/store/setToolMode.js#L213
The code here is concatenating the
mouseButtonMask
array but not removing duplicates.I'll create a PR shortly with tests showing the issue and a fix.
The text was updated successfully, but these errors were encountered: