[Interest] Should we unload() Qt plugins?

Thiago Macieira thiago.macieira at intel.com
Sun Sep 21 18:43:48 CEST 2014


On Sunday 21 September 2014 15:24:12 Stephen Kelly wrote:
> In more complex programs, it is difficult to know whether it is safe to 
> call pl.unload() because we might not know whether all objects created 
> through the plugin interface have already been destroyed.
> 
> So, should the guideline be: "Never call QPluginLoader::unload()", and 
> ignore 'still reachable' reports from valgrind?

That's up to you. If you can be sure that all uses of the plugin and pointers 
to the memory of the plugin are gone, you can unload it.

But like you said, complex applications can't know that. My recommendation is 
that you don't unload plugins.

QtCore will perform a cleanup on its own unload to try and clean up valgrind 
errors. Make sure you're running 5.2.0 or later for that.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list