aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <kde@davidedmundson.co.uk>2015-02-12 22:29:04 +0100
committerDavid Edmundson <kde@davidedmundson.co.uk>2015-02-19 11:49:31 +0100
commit5a28172868cdc51607e0e87172d4d4fb6f01b896 (patch)
tree4e45afdedca8d4f514ef1f96a41ea70a565d8f2e
parent93dd4856d096e214786734db80ac8f778b913333 (diff)
downloadkconfig-5a28172868cdc51607e0e87172d4d4fb6f01b896.tar.gz
kconfig-5a28172868cdc51607e0e87172d4d4fb6f01b896.tar.bz2
Avoid code path that leaves local config locked
The local config file gets locked on line 415, if we return early we need to unlock it. REVIEW: 122549 BUG: 344032
-rw-r--r--src/core/kconfig.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp
index 782e9714..1da816fa 100644
--- a/src/core/kconfig.cpp
+++ b/src/core/kconfig.cpp
@@ -440,6 +440,12 @@ bool KConfig::sync()
QExplicitlySharedDataPointer<KConfigBackend> tmp = KConfigBackend::create(d->sGlobalFileName);
if (d->configState == ReadWrite && !tmp->lock()) {
qWarning() << "couldn't lock global file";
+
+ //unlock the local config if we're returning early
+ if (d->mBackend->isLocked()) {
+ d->mBackend->unlock();
+ }
+
d->bDirty = true;
return false;
}