fix(segmentation): Allow for debounced pub/sub events to be reliably cancelled when unsubscribed to. (#5092)

This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2025-06-02 12:12:31 -04:00
1 parent a1fb7217bd
commit 38ed7ba744
5 files changed
+36 -9

No files matched your search

+4 -4
View File
@@ -132,6 +132,10 @@ const cornerstoneExtension: Types.Extensions.Extension = {
},
getPanelModule,
onModeExit: ({ servicesManager }: withAppTypes): void => {
unsubscriptions.forEach(unsubscribe => unsubscribe());
// Clear the unsubscriptions
unsubscriptions.length = 0;
const { cineService, segmentationService } = servicesManager.services;
// Empty out the image load and retrieval pools to prevent memory leaks
// on the mode exits
@@ -150,10 +154,6 @@ const cornerstoneExtension: Types.Extensions.Extension = {
useToggleOneUpViewportGridStore.getState().clearToggleOneUpViewportGridStore();
useSegmentationPresentationStore.getState().clearSegmentationPresentationStore();
segmentationService.removeAllSegmentations();
unsubscriptions.forEach(unsubscribe => unsubscribe());
// Clear the unsubscriptions
unsubscriptions.length = 0;
},
/**