From 938d3ce91bd436e840684c0d633df71ef33fd4e0 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Wed, 2 May 2018 17:10:38 +0100 Subject: Take a list of proxied plugins for each name to work around multiple inheritance issues --- src/plugincontainer.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/plugincontainer.cpp') diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp index f6376496..8935c472 100644 --- a/src/plugincontainer.cpp +++ b/src/plugincontainer.cpp @@ -155,14 +155,18 @@ bool PluginContainer::registerPlugin(QObject *plugin, const QString &fileName) QCoreApplication::applicationDirPath() + "/" + ToQString(AppConfig::pluginPath())); for (const QString &pluginName : pluginNames) { try { - QObject *proxiedPlugin = proxy->instantiate(pluginName); - if (proxiedPlugin != nullptr) { - if (registerPlugin(proxiedPlugin, pluginName)) { - qDebug("loaded plugin \"%s\"", qPrintable(QFileInfo(pluginName).fileName())); - } else { - qWarning("plugin \"%s\" failed to load. If this plugin is for an older version of MO " - "you have to update it or delete it if no update exists.", - qPrintable(pluginName)); + // we get a list of matching plugins as proxies don't necessarily have a good way of supporting multiple inheritance + QList matchingPlugins = proxy->instantiate(pluginName); + for (QObject *proxiedPlugin : matchingPlugins) { + if (proxiedPlugin != nullptr) { + if (registerPlugin(proxiedPlugin, pluginName)) { + qDebug("loaded plugin \"%s\"", qPrintable(QFileInfo(pluginName).fileName())); + } + else { + qWarning("plugin \"%s\" failed to load. If this plugin is for an older version of MO " + "you have to update it or delete it if no update exists.", + qPrintable(pluginName)); + } } } } catch (const std::exception &e) { -- cgit v1.3.1