Skip to content
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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alxbilger
Copy link
Contributor

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

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added the pr: status to review To notify reviewers to review this pull-request label May 6, 2024
@@ -229,6 +231,8 @@ class SOFA_HELPER_API PluginManager

PluginMap m_pluginMap;
std::map<std::string, std::function<void(const std::string&, const Plugin&)>> m_onPluginLoadedCallbacks;

sofa::type::vector<std::string> m_unloadedPlugins;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a vector and not a unordered_set since this name should be unique ? All the modifications could be done through the key directly

@alxbilger alxbilger added this to the v24.06 milestone May 14, 2024
@bakpaul bakpaul added pr: status postponed To keep in mind that this PR was interesting but no one has time to make it mergeable now. and removed pr: status to review To notify reviewers to review this pull-request labels May 14, 2024
@bakpaul
Copy link
Contributor

bakpaul commented May 14, 2024

To be discussed at the STC.

@bakpaul bakpaul modified the milestones: v24.06, v24.12 May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: status postponed To keep in mind that this PR was interesting but no one has time to make it mergeable now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants