If the new context menu is added and used multiple times in different views (e.g. DataManagerView and RenderWindowManagerView) the function InitDefaultActions is called multiple times. Since the function accesses the node descriptors as singletons, the default actions are added multiple times to the descriptors and are therefore added multiple times to the context menu.
|Open||None||T25056 Refactor data manager context menu|
|Open||None||T25643 Context menu adds its default actions multiple times|
- Mentioned In
- T25056: Refactor data manager context menu
rMITK258e0e5ae890: Merge remote-tracking branch 'origin/T25643-Context-menu-actions-added-multiple…
T24936: Extend render window manager to include functionality of the data manager
- Mentioned Here
- T19752: Fix extensibility of Data Manager context menu entries
T25583: Dynamically customize different context menus
The context menu (taken from the data manager view) also stores it's actions inside a member variable m_DescriptorActionList to later be able to remove the context menu actions from the (global) descriptors if the context menu is destroyed.
So basically we have each action stored inside the global descriptors and inside a local variable.
We could just rely on the local member and wouldn't need to struggle with the global descriptor actions.
However, this leads to the question why the global descriptors (singleton instance) are necessary in the first place. It was probably used to add local actions to the globally accessible node descriptors, e.g. from a custom plugin. So this task is closely related to T19752 and T25583.