crash--
use a pointer, so we don't do infinite stack recursion create the fallback in the proper place
This commit is contained in:
parent
d369782ae1
commit
e0db15c96d
@ -57,3 +57,5 @@ Comment[uk]=Компоненти оболонки Плазми
|
|||||||
Comment[x-test]=xxPlasma Shell Componentsxx
|
Comment[x-test]=xxPlasma Shell Componentsxx
|
||||||
Comment[zh_TW]=Plasma Shell 組件
|
Comment[zh_TW]=Plasma Shell 組件
|
||||||
|
|
||||||
|
[PropertyDef::X-KDE-fallbackPackage]
|
||||||
|
Type=QString
|
||||||
|
@ -49,7 +49,7 @@ Package::Package(PackageStructure *structure)
|
|||||||
: d(new PackagePrivate())
|
: d(new PackagePrivate())
|
||||||
{
|
{
|
||||||
d->structure = structure;
|
d->structure = structure;
|
||||||
d->fallbackPackage = Package(structure);
|
|
||||||
if (d->structure) {
|
if (d->structure) {
|
||||||
d->structure.data()->initPackage(this);
|
d->structure.data()->initPackage(this);
|
||||||
}
|
}
|
||||||
@ -498,6 +498,7 @@ void Package::setPath(const QString &path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if nothing did change, then we go back to the old dptr
|
// if nothing did change, then we go back to the old dptr
|
||||||
if (d->path == previousPath) {
|
if (d->path == previousPath) {
|
||||||
d = oldD;
|
d = oldD;
|
||||||
@ -509,6 +510,21 @@ void Package::setPath(const QString &path)
|
|||||||
delete d->metadata;
|
delete d->metadata;
|
||||||
d->metadata = 0;
|
d->metadata = 0;
|
||||||
|
|
||||||
|
QString fallback;
|
||||||
|
|
||||||
|
if (metadata().isValid()) {
|
||||||
|
fallback = metadata().property("X-KDE-fallbackPackage").toString();
|
||||||
|
}
|
||||||
|
if (!fallback.isEmpty()) {
|
||||||
|
if (!d->fallbackPackage) {
|
||||||
|
d->fallbackPackage = new Package(d->structure.data());
|
||||||
|
}
|
||||||
|
d->fallbackPackage->setPath(fallback);
|
||||||
|
} else {
|
||||||
|
delete d->fallbackPackage;
|
||||||
|
d->fallbackPackage = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// uh-oh, but we didn't end up with anything valid, so we sadly reset ourselves
|
// uh-oh, but we didn't end up with anything valid, so we sadly reset ourselves
|
||||||
// to futility.
|
// to futility.
|
||||||
if (!d->valid) {
|
if (!d->valid) {
|
||||||
@ -762,6 +778,7 @@ KJob *Package::uninstall(const QString &packageName, const QString &packageRoot)
|
|||||||
PackagePrivate::PackagePrivate()
|
PackagePrivate::PackagePrivate()
|
||||||
: QSharedData(),
|
: QSharedData(),
|
||||||
servicePrefix("plasma-applet-"),
|
servicePrefix("plasma-applet-"),
|
||||||
|
fallbackPackage(0),
|
||||||
metadata(0),
|
metadata(0),
|
||||||
externalPaths(false),
|
externalPaths(false),
|
||||||
valid(false),
|
valid(false),
|
||||||
@ -793,7 +810,7 @@ PackagePrivate &PackagePrivate::operator=(const PackagePrivate &rhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
structure = rhs.structure;
|
structure = rhs.structure;
|
||||||
fallbackPackage = Package(structure.data());
|
fallbackPackage = rhs.fallbackPackage;
|
||||||
path = rhs.path;
|
path = rhs.path;
|
||||||
contentsPrefixPaths = rhs.contentsPrefixPaths;
|
contentsPrefixPaths = rhs.contentsPrefixPaths;
|
||||||
servicePrefix = rhs.servicePrefix;
|
servicePrefix = rhs.servicePrefix;
|
||||||
@ -875,8 +892,9 @@ void PackagePrivate::createPackageMetadata(const QString &path)
|
|||||||
|
|
||||||
QString PackagePrivate::fallbackFilePath(const char *key, const QString &filename) const
|
QString PackagePrivate::fallbackFilePath(const char *key, const QString &filename) const
|
||||||
{
|
{
|
||||||
if (fallbackPackage.isValid()) {
|
//don't fallback if the package isn't valid and never fallback the metadata file
|
||||||
return fallbackPackage.filePath(key, filename);
|
if (fallbackPackage && fallbackPackage->isValid() && key != "metadata") {
|
||||||
|
return fallbackPackage->filePath(key, filename);
|
||||||
} else {
|
} else {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ public:
|
|||||||
QString servicePrefix;
|
QString servicePrefix;
|
||||||
QHash<QString, QString> discoveries;
|
QHash<QString, QString> discoveries;
|
||||||
QHash<QByteArray, ContentStructure> contents;
|
QHash<QByteArray, ContentStructure> contents;
|
||||||
Package fallbackPackage;
|
Package *fallbackPackage;
|
||||||
#ifndef PLASMA_NO_PACKAGE_EXTRADATA
|
#ifndef PLASMA_NO_PACKAGE_EXTRADATA
|
||||||
QStringList mimeTypes;
|
QStringList mimeTypes;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user