mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Guard against invalid KPackage in AppletHost
loadPackage + setPath can produce an invalid package if the shell package is missing. Guard with isValid() to avoid passing a bad package to setKPackage. Add the QML_SINGLETON factory that the QML engine requires for proper singleton instantiation.
This commit is contained in:
parent
276912bf31
commit
8fecdf1d2d
2 changed files with 9 additions and 0 deletions
|
|
@ -25,6 +25,10 @@ public:
|
||||||
{
|
{
|
||||||
KPackage::Package pkg = KPackage::PackageLoader::self()->loadPackage(u"Plasma/Shell"_s);
|
KPackage::Package pkg = KPackage::PackageLoader::self()->loadPackage(u"Plasma/Shell"_s);
|
||||||
pkg.setPath(u"org.kde.plasma.mobile"_s);
|
pkg.setPath(u"org.kde.plasma.mobile"_s);
|
||||||
|
if (!pkg.isValid()) {
|
||||||
|
qWarning() << "AppletHost: failed to load plasma shell package org.kde.plasma.mobile";
|
||||||
|
return;
|
||||||
|
}
|
||||||
setKPackage(pkg);
|
setKPackage(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,11 @@ public:
|
||||||
explicit AppletHost(QObject *parent = nullptr);
|
explicit AppletHost(QObject *parent = nullptr);
|
||||||
~AppletHost() override;
|
~AppletHost() override;
|
||||||
|
|
||||||
|
static QObject *create(QQmlEngine * /*engine*/, QJSEngine * /*scriptEngine*/)
|
||||||
|
{
|
||||||
|
return new AppletHost();
|
||||||
|
}
|
||||||
|
|
||||||
Q_INVOKABLE QQuickItem *fullRepresentationFor(const QString &pluginId);
|
Q_INVOKABLE QQuickItem *fullRepresentationFor(const QString &pluginId);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue