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
Scripting: Add first-class support for "factory" method #4205
Comments
VTK_NEWINSTANCE macro is available in Slicer's VTK version, so we could mark factory methods return object instance that does not require "UnRegister". There are only 13 Python files in Slicer core that would need to be updated, so that's very easy. Probably a number of extensions are impacted as well, which is not very nice (the extra UnRegister will cause Slicer to crash), but Slicer5 would be a good opportunity for making a breaking change like this. @jcfr @pieper @cpinter @Sunderlandkyl @fedorov what do you think? |
Yes, makes sense to do the breaking change now. |
I'd like to add that this memory management information from the wiki never made it to readthedocs. While factory method support is added to the python side, it might be good to transfer an updated version of the information from that page into readthedocs. Less related, on the C++ side: there is nothing in the API documentation for "factory functions" such as |
@ebrahimebrahim it would be great if you could copy the content to https://github.com/Slicer/Slicer/tree/master/Docs/developer_guide. Probably a new memory_management.md file could be added. Once that's done I would update the wiki page to redirect to the readthedocs page. There are MediaWiki to Markdown converters, but they tend make small mistakes, so for short pages like this it is probably not worth using them. Adding the VTK_NEWINSTANCE macro should be probably done later, in Slicer-5.1, because the Slicer-5.0 release date is (hopefully) close and it is better to separate this change. Since this API change will make Slicer crash when extensions call UnRegister, we may consider changing the method names and deprecate the old methods. There is some inconsistency anyway between creation of display and storage nodes, so renames would be useful anyway. |
@lassoan Do we know exactly what the effects will be in the |
@Connor-Bowley Good point, I guess it's not |
When we add |
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The text was updated successfully, but these errors were encountered: