From b4f4515d2ad528d71d4c77991d117eba8b5eb8f1 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 8 Aug 2014 07:22:45 +0200 Subject: [PATCH] detach on file/directory definition add --- src/plasma/package.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/plasma/package.cpp b/src/plasma/package.cpp index 0c881db9d..a398b227e 100644 --- a/src/plasma/package.cpp +++ b/src/plasma/package.cpp @@ -585,8 +585,17 @@ void Package::addDirectoryDefinition(const char *key, const QString &path, const if (d->contents.contains(key)) { s = d->contents[key]; + if (s.paths.contains(path) && s.directory == true +#ifndef PLASMA_NO_PACKAGE_EXTRADATA + && s.name == name +#endif + ) { + return; + } } + d.detach(); + #ifndef PLASMA_NO_PACKAGE_EXTRADATA if (!name.isEmpty()) { s.name = name; @@ -607,8 +616,16 @@ void Package::addFileDefinition(const char *key, const QString &path, const QStr if (d->contents.contains(key)) { s = d->contents[key]; + if (s.paths.contains(path) && s.directory == false +#ifndef PLASMA_NO_PACKAGE_EXTRADATA + && s.name == name +#endif + ) { + return; + } } + d.detach(); #ifndef PLASMA_NO_PACKAGE_EXTRADATA if (!name.isEmpty()) { s.name = name; @@ -625,7 +642,10 @@ void Package::addFileDefinition(const char *key, const QString &path, const QStr void Package::removeDefinition(const char *key) { - d->contents.remove(key); + if (d->contents.contains(key)) { + d.detach(); + d->contents.remove(key); + } } void Package::setRequired(const char *key, bool required)