Rework our plugin loading code
In Qt5, one should essentially never ever unload a plugin which happens
to use Qt classes. This is very visible when one uses a QStringLiteral.
According to Thiago, unloading C++ plugins is very dangerous because
some class instances might have vtables which point to the code that
we're just unloading. We could probably handle this (by ensuring that
all plugin jobs are destroyed, and I mean C++-like destroyed with no
references held), but the QStringLiteral and any caches are a problem on
their own. For more context, please see [1] and [2].
Let's change the plugin loading code so that it stops unloading the
detected plugins no matter if they are used or unused. Note that we are
*not* actually *creating* the plugin implementations themselves (for
example, we aren't instantiating any actual address book implementation,
just the relatively small wrapper, the factory class.
I also took the liberty to refactor the code a bit. It now explicitly
uses class types for specifying if it's a password or address book
plugin, and bits of QLibrary for testing if it's indeed a plugin in the
first place (so that it skips irrelevant stuff in the build dir).
Change-Id: I7f8da24ac37ec52ba056da486a43ea3fbe7d5222
12 files changed: