sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
878 stars 297 forks source link

[Core,Helper] Prevent to create objects from unloaded plugins #4722

Open alxbilger opened 3 weeks ago

alxbilger commented 3 weeks ago

When a plugin is loaded, the ObjectFactory is populated of Components from this plugin. However, when this plugin "unloaded", it was still possible to create a component from the plugin. This PR detects that the ObjectFactory tries to instantiate an object that is from an unloaded plugin. It is particularly useful when the initialization of the plugin fails (SofaCUDA for example). When the initialization fails, the plugin is unloaded. A unit test is provided


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

bakpaul commented 2 weeks ago

To be discussed at the STC.