cornerstonejs / cornerstone

JavaScript library to display interactive medical images including but not limited to DICOM
https://docs.cornerstonejs.org/
MIT License
2.06k stars 598 forks source link

fix #444: self removal of an event listener causing unexpected behavior #506

Closed Daymannovaes closed 3 years ago

Daymannovaes commented 3 years ago

Fix for https://github.com/cornerstonejs/cornerstone/issues/444.

The solution is simply to duplicate the array before running the listeners. This is a common approach in event emitters implementation, and won't cause performance issues because the copy is shallow and most of the time there are only one or a few listeners for each event.

swederik commented 3 years ago

Thanks!

swederik commented 3 years ago

:tada: This PR is included in version 2.4.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: