The plugin loader can only hold a reference to one instance at a time. If you reuse the same instance of QPluginLoader for many plugins then you are responsible for deleting all the objects yourself.
The plugin loader can only hold a reference to one instance at a time. If you reuse the same instance of QPluginLoader for many plugins then you are responsible for deleting all the objects yourself.
Ok,
I've correct my code, but the problem is the same:
To call the destructor of the plugin I need to call the unload() function of the QPluginLoader.
Is it an expected behaviour?
You mean that if you do:
Qt Code:
QObjectList list; list << loader.instance();To copy to clipboard, switch view to plain text mode
and then:
the destructor is not called?Qt Code:
To copy to clipboard, switch view to plain text mode
I've a plugin that handle a thread that do some work.
When the app is closed, I want to be sure that this plugin close all the worker thread.
To do this I want to run some code during the closure of the plugin.
At the start I think to do this on the plugin destructor but I test that without unload() the pluginLoader the plugin destructor is not invoked.
On the Qt examples there is not pluginLoader unload() and when the app is closed no plugin destructor is invoked.
My questions:
As your opinion, has any sense to put any code on the plugin destructor, or I need to call another plugin method to do this operation before the plugin is closed??
Does I need to call the unload() function of the pluginLoader?
Which is the safe mode to delete the plugin instances?
Many thanks![]()
Bookmarks