Plugins are not currently unloaded before programs exit. With this patch I suggest the following:
- In ExtensionRegistry methods are added which makes it possible for the user to unregister individual plugins or to clear all loaded extensions.
- In Plugin a wrapper is added that makes sure that the plugin is unloaded when there are no references left to the plugin.
This patch will make sure that plugins are closed properly, avoiding reports of memory leaks from valgrind. When ExtensionRegistry is destructed, the smart pointers to plugins are deleted. This will in turn make sure that the plugins are closed.