example illustrating two issues #37
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This isn't actually a PR, but a bug report. But the patch contains two example .cpp files illustrating the issues. IMHO the pluginlib doesn't work in cases where control over destruction of the ClassLoader is not possible. Typical use cases are e.g. liburdf to load urdf parsers.
issue1.cpp illustrates the use case I would expect:
In some function a
ClassLoaderis instantiated, some object from the lib is created and the ClassLoader is destroyed again. The destructor of ClassLoader tries to unload the lib, although the object is still in use.libclass_loadercorrectly notices the fact and denies unloading with aSEVERE WARNING.IMHO, pluginlib's
ClassLoadershould simply uselibclass_loader'sondemand_load_unloadfeature.issue2.cpp illustrates actually an issue in
libclass_loader:As a work-around for issue1, people define their
ClassLoaderasstatic, thus postponing library unloading until program shutdown. However, as the order of releasingstaticvariables is undefined, this fails, because an already freed static mutex is accessed: