1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

PyFalkon: Fix build with clang

BUG: 407734
FIXED-IN: 3.2.0
This commit is contained in:
David Rosca 2019-05-20 15:21:09 +02:00
parent fb09c266a7
commit 2098d69ad1
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 20 additions and 12 deletions

View File

@ -415,18 +415,26 @@ Plugins::Plugin Plugins::loadSharedLibraryPlugin(const QString &name)
Plugins::Plugin Plugins::loadPythonPlugin(const QString &name)
{
Plugin out;
if (!m_pythonPlugin) {
qWarning() << "Python support plugin is not loaded";
return Plugin();
return out;
}
auto f = (Plugin(*)(const QString &)) m_pythonPlugin->resolve("pyfalkon_load_plugin");
auto f = (Plugin*(*)(const QString &)) m_pythonPlugin->resolve("pyfalkon_load_plugin");
if (!f) {
qWarning() << "Failed to resolve" << "pyfalkon_load_plugin";
return Plugin();
return out;
}
return f(name);
Plugin *p = f(name);
if (p) {
out = *p;
delete p;
}
return out;
}
bool Plugins::initPlugin(PluginInterface::InitState state, Plugin *plugin)

View File

@ -82,7 +82,7 @@ void pyfalkon_register_plugin(PluginInterface *plugin)
pluginInterface = plugin;
}
Plugins::Plugin pyfalkon_load_plugin(const QString &name)
Plugins::Plugin *pyfalkon_load_plugin(const QString &name)
{
QString fullPath;
if (QFileInfo(name).isAbsolute()) {
@ -91,15 +91,15 @@ Plugins::Plugin pyfalkon_load_plugin(const QString &name)
fullPath = DataPaths::locate(DataPaths::Plugins, name);
if (fullPath.isEmpty()) {
qWarning() << "Python plugin" << name << "not found";
return Plugins::Plugin();
return nullptr;
}
}
Plugins::Plugin plugin;
plugin.type = Plugins::Plugin::PythonPlugin;
plugin.pluginId = QSL("python:%1").arg(QFileInfo(name).fileName());
plugin.pluginPath = fullPath;
plugin.pluginSpec = Plugins::createSpec(DesktopFile(fullPath + QSL("/metadata.desktop")));
Plugins::Plugin *plugin = new Plugins::Plugin;
plugin->type = Plugins::Plugin::PythonPlugin;
plugin->pluginId = QSL("python:%1").arg(QFileInfo(name).fileName());
plugin->pluginPath = fullPath;
plugin->pluginSpec = Plugins::createSpec(DesktopFile(fullPath + QSL("/metadata.desktop")));
return plugin;
}

View File

@ -21,5 +21,5 @@
void pyfalkon_register_plugin(PluginInterface *plugin);
extern "C" Q_DECL_EXPORT Plugins::Plugin pyfalkon_load_plugin(const QString &name);
extern "C" Q_DECL_EXPORT Plugins::Plugin *pyfalkon_load_plugin(const QString &name);
extern "C" Q_DECL_EXPORT void pyfalkon_init_plugin(Plugins::Plugin *plugin);