void-packages/srcpkgs/krita/patches/afed6a9e.patch

476 lines
21 KiB
Diff

From afed6a9e53f79710e7df4c9e42b28ab5a794ad6c Mon Sep 17 00:00:00 2001
From: Boudewijn Rempt <boud@valdyas.org>
Date: Wed, 1 Apr 2020 12:12:28 +0200
Subject: [PATCH] Do not load plugins from plugins that are being loaded
Arrange the initialization of the registries so that all plugins
are loaded in the right order and don't accidentally initialize
a registry while they are being loaded.
BUG:419475
---
libs/flake/KoDockRegistry.cpp | 4 ++--
libs/flake/KoFilterEffectRegistry.cpp | 2 +-
libs/flake/KoInputDeviceHandlerRegistry.cpp | 4 ++--
libs/flake/KoShapeFactoryBase.cpp | 2 +-
libs/flake/KoShapeRegistry.cpp | 6 ++---
libs/flake/KoToolRegistry.cpp | 6 ++---
libs/flake/Mainpage.dox | 4 ++--
libs/koplugin/CMakeLists.txt | 1 +
libs/koplugin/KoPluginLoader.cpp | 6 ++++-
libs/koplugin/KoPluginLoader.h | 4 ++--
libs/pigment/KoColorSpaceRegistry.cpp | 8 +++----
libs/ui/KisApplication.cpp | 23 ++++---------------
.../krita_colorspaces_extensions_plugin.json | 2 +-
plugins/color/lcms2engine/kolcmsengine.json | 2 +-
.../svgcollectiondocker.json | 2 +-
.../calligra_shape_artistictext.json | 2 +-
.../imageshape/calligra_shape_image.json | 2 +-
.../pathshapes/calligra_shape_paths.json | 2 +-
.../flake/textshape/calligra_shape_text.json | 2 +-
.../kotext/KoInlineObjectRegistry.cpp | 4 ++--
.../kotext/KoTextEditingRegistry.cpp | 4 ++--
.../textshape/kotext/texteditingplugin.json | 4 ++--
.../defaulttool/calligra_tool_defaults.json | 2 +-
.../karbonplugins/tools/karbon_tools.json | 2 +-
.../tools/svgtexttool/krita_tool_svgtext.json | 2 +-
25 files changed, 47 insertions(+), 55 deletions(-)
diff --git a/libs/flake/KoDockRegistry.cpp b/libs/flake/KoDockRegistry.cpp
index 1cba940727..6693b163b7 100644
--- libs/flake/KoDockRegistry.cpp
+++ libs/flake/KoDockRegistry.cpp
@@ -40,8 +40,8 @@ void KoDockRegistry::init()
KoPluginLoader::PluginsConfig config;
config.whiteList = "DockerPlugins";
config.blacklist = "DockerPluginsDisabled";
- config.group = "calligra";
- KoPluginLoader::instance()->load(QString::fromLatin1("Calligra/Dock"),
+ config.group = "krita";
+ KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Dock"),
QString::fromLatin1("[X-Flake-PluginVersion] == 28"),
config);
}
diff --git a/libs/flake/KoFilterEffectRegistry.cpp b/libs/flake/KoFilterEffectRegistry.cpp
index 2f8346bbdc..2ff63e2698 100644
--- libs/flake/KoFilterEffectRegistry.cpp
+++ libs/flake/KoFilterEffectRegistry.cpp
@@ -40,7 +40,7 @@ void KoFilterEffectRegistry::init()
KoPluginLoader::PluginsConfig config;
config.whiteList = "FilterEffectPlugins";
config.blacklist = "FilterEffectPluginsDisabled";
- KoPluginLoader::instance()->load(QString::fromLatin1("Calligra/FilterEffect"),
+ KoPluginLoader::instance()->load(QString::fromLatin1("Krita/FilterEffect"),
QString::fromLatin1("[X-Flake-PluginVersion] == 28"),
config);
}
diff --git a/libs/flake/KoInputDeviceHandlerRegistry.cpp b/libs/flake/KoInputDeviceHandlerRegistry.cpp
index 17def3b2d5..31c83ccfc9 100644
--- libs/flake/KoInputDeviceHandlerRegistry.cpp
+++ libs/flake/KoInputDeviceHandlerRegistry.cpp
@@ -35,8 +35,8 @@ void KoInputDeviceHandlerRegistry::init()
KoPluginLoader::PluginsConfig config;
config.whiteList = "DevicePlugins";
config.blacklist = "DevicePluginsDisabled";
- config.group = "calligra";
- KoPluginLoader::instance()->load(QString::fromLatin1("Calligra/Device"),
+ config.group = "krita";
+ KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Device"),
QString::fromLatin1("[X-Flake-PluginVersion] == 28"), config);
Q_FOREACH (const QString & id, keys()) {
diff --git a/libs/flake/KoShapeFactoryBase.cpp b/libs/flake/KoShapeFactoryBase.cpp
index dd36cb2504..476817a5e5 100644
--- libs/flake/KoShapeFactoryBase.cpp
+++ libs/flake/KoShapeFactoryBase.cpp
@@ -233,7 +233,7 @@ void KoShapeFactoryBase::getDeferredPlugin()
QMutexLocker(&d->pluginLoadingMutex);
if (d->deferredFactory) return;
- const QList<QPluginLoader *> offers = KoJsonTrader::instance()->query("Calligra/Deferred", QString());
+ const QList<QPluginLoader *> offers = KoJsonTrader::instance()->query("Krita/Deferred", QString());
Q_ASSERT(offers.size() > 0);
Q_FOREACH (QPluginLoader *pluginLoader, offers) {
diff --git a/libs/flake/KoShapeRegistry.cpp b/libs/flake/KoShapeRegistry.cpp
index d70d101726..468294f1a0 100644
--- libs/flake/KoShapeRegistry.cpp
+++ libs/flake/KoShapeRegistry.cpp
@@ -78,13 +78,13 @@ void KoShapeRegistry::Private::init(KoShapeRegistry *q)
KoPluginLoader::PluginsConfig config;
config.whiteList = "FlakePlugins";
config.blacklist = "FlakePluginsDisabled";
- config.group = "calligra";
- KoPluginLoader::instance()->load(QString::fromLatin1("Calligra/Flake"),
+ config.group = "krita";
+ KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Flake"),
QString::fromLatin1("[X-Flake-PluginVersion] == 28"),
config);
config.whiteList = "ShapePlugins";
config.blacklist = "ShapePluginsDisabled";
- KoPluginLoader::instance()->load(QString::fromLatin1("Calligra/Shape"),
+ KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Shape"),
QString::fromLatin1("[X-Flake-PluginVersion] == 28"),
config);
diff --git a/libs/flake/KoToolRegistry.cpp b/libs/flake/KoToolRegistry.cpp
index f893b339be..175bef1cc2 100644
--- libs/flake/KoToolRegistry.cpp
+++ libs/flake/KoToolRegistry.cpp
@@ -42,10 +42,10 @@ KoToolRegistry::KoToolRegistry()
void KoToolRegistry::init()
{
KoPluginLoader::PluginsConfig config;
- config.group = "calligra";
+ config.group = "krita";
config.whiteList = "ToolPlugins";
config.blacklist = "ToolPluginsDisabled";
- KoPluginLoader::instance()->load(QString::fromLatin1("Calligra/Tool"),
+ KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Tool"),
QString::fromLatin1("[X-Flake-PluginVersion] == 28"),
config);
@@ -53,7 +53,7 @@ void KoToolRegistry::init()
add(new KoPathToolFactory());
add(new KoZoomToolFactory());
- KConfigGroup cfg = KSharedConfig::openConfig()->group("calligra");
+ KConfigGroup cfg = KSharedConfig::openConfig()->group("krita");
QStringList toolsBlacklist = cfg.readEntry("ToolsBlacklist", QStringList());
foreach (const QString& toolID, toolsBlacklist) {
delete value(toolID);
diff --git a/libs/flake/Mainpage.dox b/libs/flake/Mainpage.dox
index 8c05a437d1..2927ad62b4 100644
--- libs/flake/Mainpage.dox
+++ libs/flake/Mainpage.dox
@@ -2,7 +2,7 @@
* \mainpage Flake
*
* The Flake library is a low level library for all kinds of graphical content
- * to be placed on any Calligra canvas. This includes a line to text-areas or
+ * to be placed on any Krita canvas. This includes a line to text-areas or
* even movies. Just as important, this library will include tools to manipulate
* the graphical content. At least at the level of Flake objects. This goes from
* moving/rotating the object to a basis for complex brushes for a paint program.
@@ -59,7 +59,7 @@
[Desktop Entry]
Encoding=UTF-8
Name=My Flake Shapes Plugin
-ServiceTypes=Calligra/Shape
+ServiceTypes=Krita/Shape
Type=Service
X-KDE-PluginInfo-Name=myflakeshapes
X-KDE-Library=myflakeshapesplugin
diff --git a/libs/koplugin/CMakeLists.txt b/libs/koplugin/CMakeLists.txt
index fc048721a7..34a7db4cf8 100644
--- libs/koplugin/CMakeLists.txt
+++ libs/koplugin/CMakeLists.txt
@@ -18,6 +18,7 @@ target_link_libraries(kritaplugin
PUBLIC
Qt5::Core
PRIVATE
+ kritaglobal
KF5::ConfigCore
KF5::CoreAddons
KF5::I18n
diff --git a/libs/koplugin/KoPluginLoader.cpp b/libs/koplugin/KoPluginLoader.cpp
index cba012e190..647d664cd8 100644
--- libs/koplugin/KoPluginLoader.cpp
+++ libs/koplugin/KoPluginLoader.cpp
@@ -26,6 +26,8 @@
#include "KritaPluginDebug.h"
+#include <kis_debug.h>
+
#include <KConfig>
#include <KSharedConfig>
#include <KConfigGroup>
@@ -56,6 +58,7 @@ KoPluginLoader* KoPluginLoader::instance()
void KoPluginLoader::load(const QString & serviceType, const QString & versionString, const PluginsConfig &config, QObject* owner, bool cache)
{
+
// Don't load the same plugins again
if (cache && d->loadedServiceTypes.contains(serviceType)) {
return;
@@ -94,6 +97,7 @@ void KoPluginLoader::load(const QString & serviceType, const QString & versionSt
qWarning() << "Loading plugin" << loader->fileName() << "failed, has no X-KDE-PluginInfo-Name.";
continue;
}
+
if (whiteList.contains(pluginName)) {
plugins.append(loader);
}
@@ -141,7 +145,7 @@ void KoPluginLoader::load(const QString & serviceType, const QString & versionSt
json = json.value("KPlugin").toObject();
const QString pluginName = json.value("Id").toString();
whiteList << pluginName;
- debugPlugin << "Loaded plugin" << loader->fileName() << owner;
+ debugPlugin << "\tLoaded plugin" << loader->fileName() << owner;
if (!owner) {
delete plugin;
}
diff --git a/libs/koplugin/KoPluginLoader.h b/libs/koplugin/KoPluginLoader.h
index 82aa0079ec..e21f8a4e4e 100644
--- libs/koplugin/KoPluginLoader.h
+++ libs/koplugin/KoPluginLoader.h
@@ -77,7 +77,7 @@ public:
* /code
* KConfigGroup configGroup = KSharedConfig::openConfig()->group(config.group);
* /endcode
- * For most cases you can pass the string "calligra" into this variable.
+ * For most cases you can pass the string "krita" into this variable.
*/
const char * group;
/// This contains the variable name for the list of plugins (by library name) the user wants to load
@@ -100,7 +100,7 @@ public:
/**
* Load all plugins that conform to the versiontype and versionstring,
* for instance:
- * KoPluginLoader::instance()->load("Calligra/Flake", "([X-Flake-PluginVersion] == 28)");
+ * KoPluginLoader::instance()->load("Krita/Flake", "([X-Flake-PluginVersion] == 28)");
* This method allows you to optionally limit the plugins that are loaded by version, but also
* using a user configurable set of config options.
* If you pass a PluginsConfig struct only those plugins are loaded that are specified in the
diff --git a/libs/pigment/KoColorSpaceRegistry.cpp b/libs/pigment/KoColorSpaceRegistry.cpp
index b3843fdabb..f3b0a43538 100644
--- libs/pigment/KoColorSpaceRegistry.cpp
+++ libs/pigment/KoColorSpaceRegistry.cpp
@@ -196,14 +196,14 @@ void KoColorSpaceRegistry::init()
KoPluginLoader::PluginsConfig config;
config.whiteList = "ColorSpacePlugins";
config.blacklist = "ColorSpacePluginsDisabled";
- config.group = "calligra";
- KoPluginLoader::instance()->load("Calligra/ColorSpace", "[X-Pigment-PluginVersion] == 28", config);
+ config.group = "krita";
+ KoPluginLoader::instance()->load("Krita/ColorSpace", "[X-Pigment-PluginVersion] == 28", config);
KoPluginLoader::PluginsConfig configExtensions;
configExtensions.whiteList = "ColorSpaceExtensionsPlugins";
configExtensions.blacklist = "ColorSpaceExtensionsPluginsDisabled";
- configExtensions.group = "calligra";
- KoPluginLoader::instance()->load("Calligra/ColorSpaceExtension", "[X-Pigment-PluginVersion] == 28", configExtensions);
+ configExtensions.group = "krita";
+ KoPluginLoader::instance()->load("Krita/ColorSpaceExtension", "[X-Pigment-PluginVersion] == 28", configExtensions);
dbgPigment << "Loaded the following colorspaces:";
diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp
index 2691829846..80eac2a1e4 100644
--- libs/ui/KisApplication.cpp
+++ libs/ui/KisApplication.cpp
@@ -49,6 +49,8 @@
#include <kconfig.h>
#include <kconfiggroup.h>
+#include <KoDockRegistry.h>
+#include <KoToolRegistry.h>
#include <KoColorSpaceRegistry.h>
#include <KoPluginLoader.h>
#include <KoShapeRegistry.h>
@@ -323,32 +325,17 @@ void KisApplication::loadPlugins()
KoShapeRegistry* r = KoShapeRegistry::instance();
r->add(new KisShapeSelectionFactory());
-
+ KoColorSpaceRegistry::instance();
KisActionRegistry::instance();
KisFilterRegistry::instance();
KisGeneratorRegistry::instance();
KisPaintOpRegistry::instance();
- KoColorSpaceRegistry::instance();
+ KoToolRegistry::instance();
+ KoDockRegistry::instance();
}
void KisApplication::loadGuiPlugins()
{
- // qDebug() << "loadGuiPlugins();";
- // Load the krita-specific tools
- setSplashScreenLoadingText(i18n("Loading Plugins for Krita/Tool..."));
- processEvents();
- // qDebug() << "loading tools";
- KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Tool"),
- QString::fromLatin1("[X-Krita-Version] == 28"));
-
-
- // Load dockers
- setSplashScreenLoadingText(i18n("Loading Plugins for Krita/Dock..."));
- processEvents();
- // qDebug() << "loading dockers";
- KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Dock"),
- QString::fromLatin1("[X-Krita-Version] == 28"));
-
// XXX_EXIV: make the exiv io backends real plugins
setSplashScreenLoadingText(i18n("Loading Plugins Exiv/IO..."));
processEvents();
diff --git a/plugins/color/colorspaceextensions/krita_colorspaces_extensions_plugin.json b/plugins/color/colorspaceextensions/krita_colorspaces_extensions_plugin.json
index 6218963921..9a0df94661 100644
--- plugins/color/colorspaceextensions/krita_colorspaces_extensions_plugin.json
+++ plugins/color/colorspaceextensions/krita_colorspaces_extensions_plugin.json
@@ -4,7 +4,7 @@
"X-KDE-Library": "krita_colorspaces_extensions",
"X-KDE-PluginInfo-Name": "krita_colorspaces_extensions",
"X-KDE-ServiceTypes": [
- "Calligra/ColorSpaceExtension"
+ "Krita/ColorSpaceExtension"
],
"X-Pigment-MinVersion": "28",
"X-Pigment-PluginVersion": "28"
diff --git a/plugins/color/lcms2engine/kolcmsengine.json b/plugins/color/lcms2engine/kolcmsengine.json
index 2311c3f54c..05bbf640a6 100644
--- plugins/color/lcms2engine/kolcmsengine.json
+++ plugins/color/lcms2engine/kolcmsengine.json
@@ -4,7 +4,7 @@
"X-KDE-Library": "kritalcmsengine",
"X-KDE-PluginInfo-Name": "kritalcmsengine",
"X-KDE-ServiceTypes": [
- "Calligra/ColorSpace"
+ "Krita/ColorSpace"
],
"X-Pigment-MinVersion": "28",
"X-Pigment-PluginVersion": "28"
diff --git a/plugins/dockers/svgcollectiondocker/svgcollectiondocker.json b/plugins/dockers/svgcollectiondocker/svgcollectiondocker.json
index f7ee406724..57758ed686 100644
--- plugins/dockers/svgcollectiondocker/svgcollectiondocker.json
+++ plugins/dockers/svgcollectiondocker/svgcollectiondocker.json
@@ -5,6 +5,6 @@
"X-Flake-PluginVersion": "28",
"X-KDE-Library": "kritasvgcollectiondocker",
"X-KDE-ServiceTypes": [
- "Calligra/Dock"
+ "Krita/Dock"
]
}
diff --git a/plugins/flake/artistictextshape/calligra_shape_artistictext.json b/plugins/flake/artistictextshape/calligra_shape_artistictext.json
index c28b6d8538..b6737df41c 100644
--- plugins/flake/artistictextshape/calligra_shape_artistictext.json
+++ plugins/flake/artistictextshape/calligra_shape_artistictext.json
@@ -6,6 +6,6 @@
"X-KDE-Library": "krita_shape_artistictext",
"X-KDE-PluginInfo-Name": "krita_artistictextshape",
"X-KDE-ServiceTypes": [
- "Calligra/Shape"
+ "Krita/Shape"
]
}
diff --git a/plugins/flake/imageshape/calligra_shape_image.json b/plugins/flake/imageshape/calligra_shape_image.json
index 9c60a2aad7..25c14f2abf 100644
--- plugins/flake/imageshape/calligra_shape_image.json
+++ plugins/flake/imageshape/calligra_shape_image.json
@@ -6,6 +6,6 @@
"X-KDE-Library": "krita_shape_image",
"X-KDE-PluginInfo-Name": "imageshape",
"X-KDE-ServiceTypes": [
- "Calligra/Flake"
+ "Krita/Flake"
]
}
diff --git a/plugins/flake/pathshapes/calligra_shape_paths.json b/plugins/flake/pathshapes/calligra_shape_paths.json
index 030a60b4ad..3cf7f4a7ee 100644
--- plugins/flake/pathshapes/calligra_shape_paths.json
+++ plugins/flake/pathshapes/calligra_shape_paths.json
@@ -7,6 +7,6 @@
"X-KDE-Library": "krita_shape_paths",
"X-KDE-PluginInfo-Name": "pathshapes",
"X-KDE-ServiceTypes": [
- "Calligra/Shape"
+ "Krita/Shape"
]
}
diff --git a/plugins/flake/textshape/calligra_shape_text.json b/plugins/flake/textshape/calligra_shape_text.json
index 1272665c51..8a2cb2f9d1 100644
--- plugins/flake/textshape/calligra_shape_text.json
+++ plugins/flake/textshape/calligra_shape_text.json
@@ -6,6 +6,6 @@
"X-KDE-Library": "krita_shape_text",
"X-KDE-PluginInfo-Name": "textshape",
"X-KDE-ServiceTypes": [
- "Calligra/Flake"
+ "Krita/Flake"
]
}
diff --git a/plugins/flake/textshape/kotext/KoInlineObjectRegistry.cpp b/plugins/flake/textshape/kotext/KoInlineObjectRegistry.cpp
index 664bfedcc8..f1db33e7b1 100644
--- plugins/flake/textshape/kotext/KoInlineObjectRegistry.cpp
+++ plugins/flake/textshape/kotext/KoInlineObjectRegistry.cpp
@@ -47,8 +47,8 @@ void KoInlineObjectRegistry::Private::init(KoInlineObjectRegistry *q)
KoPluginLoader::PluginsConfig config;
config.whiteList = "TextInlinePlugins";
config.blacklist = "TextInlinePluginsDisabled";
- config.group = "calligra";
- KoPluginLoader::instance()->load(QString::fromLatin1("Calligra/Text-InlineObject"),
+ config.group = "krita";
+ KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Text-InlineObject"),
QString::fromLatin1("[X-KoText-PluginVersion] == 28"), config);
foreach (KoInlineObjectFactoryBase *factory, q->values()) {
diff --git a/plugins/flake/textshape/kotext/KoTextEditingRegistry.cpp b/plugins/flake/textshape/kotext/KoTextEditingRegistry.cpp
index a8be81e4c1..ab29cd9299 100644
--- plugins/flake/textshape/kotext/KoTextEditingRegistry.cpp
+++ plugins/flake/textshape/kotext/KoTextEditingRegistry.cpp
@@ -29,8 +29,8 @@ void KoTextEditingRegistry::init()
KoPluginLoader::PluginsConfig config;
config.whiteList = "TextEditingPlugins";
config.blacklist = "TextEditingPluginsDisabled";
- config.group = "calligra";
- KoPluginLoader::instance()->load(QString::fromLatin1("Calligra/Text-EditingPlugin"),
+ config.group = "krita";
+ KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Text-EditingPlugin"),
QString::fromLatin1("[X-KoText-PluginVersion] == 28"), config);
}
diff --git a/plugins/flake/textshape/kotext/texteditingplugin.json b/plugins/flake/textshape/kotext/texteditingplugin.json
index 8687613f11..0c0c34ddfb 100644
--- plugins/flake/textshape/kotext/texteditingplugin.json
+++ plugins/flake/textshape/kotext/texteditingplugin.json
@@ -1,6 +1,6 @@
{
"Comment": "Definition of a text-editing plugin",
- "Id": "Text Editing plugin for the Calligra text tool",
+ "Id": "Text Editing plugin for the Krita text tool",
"Type": "ServiceType",
- "X-KDE-ServiceType": "Calligra/Text-EditingPlugin"
+ "X-KDE-ServiceType": "Krita/Text-EditingPlugin"
}
diff --git a/plugins/tools/defaulttool/calligra_tool_defaults.json b/plugins/tools/defaulttool/calligra_tool_defaults.json
index 0bb9c8ade2..c29908d463 100644
--- plugins/tools/defaulttool/calligra_tool_defaults.json
+++ plugins/tools/defaulttool/calligra_tool_defaults.json
@@ -6,6 +6,6 @@
"X-KDE-Library": "krita_flaketools",
"X-KDE-PluginInfo-Name": "defaulttools",
"X-KDE-ServiceTypes": [
- "Calligra/Tool"
+ "Krita/Tool"
]
}
diff --git a/plugins/tools/karbonplugins/tools/karbon_tools.json b/plugins/tools/karbonplugins/tools/karbon_tools.json
index 8564532c91..391d90e5b3 100644
--- plugins/tools/karbonplugins/tools/karbon_tools.json
+++ plugins/tools/karbonplugins/tools/karbon_tools.json
@@ -6,6 +6,6 @@
"X-KDE-Library": "krita_karbon_tools",
"X-KDE-PluginInfo-Name": "krita_karbontools",
"X-KDE-ServiceTypes": [
- "Calligra/Tool"
+ "Krita/Tool"
]
}
diff --git a/plugins/tools/svgtexttool/krita_tool_svgtext.json b/plugins/tools/svgtexttool/krita_tool_svgtext.json
index e788be7e4d..205c28fa72 100644
--- plugins/tools/svgtexttool/krita_tool_svgtext.json
+++ plugins/tools/svgtexttool/krita_tool_svgtext.json
@@ -6,6 +6,6 @@
"X-KDE-Library": "krita_tool_svgtext",
"X-KDE-PluginInfo-Name": "svgtexttool",
"X-KDE-ServiceTypes": [
- "Calligra/Tool"
+ "Krita/Tool"
]
}
--
2.26.0