[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-baseapps/KDE/4.9] dolphin/src/views/versioncontrol: Fix race condition and deadlock in the vers
From: Simeon Bird <spb () ias ! edu>
Date: 2012-10-20 1:07:59
Message-ID: 20121020010759.74ED4A6078 () git ! kde ! org
[Download RAW message or body]
Git commit 4bdf134cbd3543fbf0273ed49e2b13b3ce49744e by Simeon Bird.
Committed on 20/10/2012 at 03:04.
Pushed by sbird into branch 'KDE/4.9'.
Fix race condition and deadlock in the version plugin
when listing directories is slow.
BUG: 302264
FIXED-IN: 4.9.3
M +6 -3 dolphin/src/views/versioncontrol/updateitemstatesthread.cpp
http://commits.kde.org/kde-baseapps/4bdf134cbd3543fbf0273ed49e2b13b3ce49744e
diff --git a/dolphin/src/views/versioncontrol/updateitemstatesthread.cpp \
b/dolphin/src/views/versioncontrol/updateitemstatesthread.cpp index f9746aa..e07d72c \
100644
--- a/dolphin/src/views/versioncontrol/updateitemstatesthread.cpp
+++ b/dolphin/src/views/versioncontrol/updateitemstatesthread.cpp
@@ -45,10 +45,12 @@ UpdateItemStatesThread::~UpdateItemStatesThread()
void UpdateItemStatesThread::setData(KVersionControlPlugin* plugin,
const QList<VersionControlObserver::ItemState>& \
itemStates) {
+ // The locks are taken in the same order as in run()
+ // to avoid potential deadlock.
+ QMutexLocker pluginLocker(m_globalPluginMutex);
QMutexLocker itemLocker(&m_itemMutex);
- m_itemStates = itemStates;
- QMutexLocker pluginLocker(m_globalPluginMutex);
+ m_itemStates = itemStates;
m_plugin = plugin;
}
@@ -58,11 +60,12 @@ void UpdateItemStatesThread::run()
Q_ASSERT(m_plugin);
QMutexLocker itemLocker(&m_itemMutex);
+
const QString directory = \
m_itemStates.first().item.url().directory(KUrl::AppendTrailingSlash); + \
m_retrievedItems = false; itemLocker.unlock();
QMutexLocker pluginLocker(m_globalPluginMutex);
- m_retrievedItems = false;
if (m_plugin->beginRetrieval(directory)) {
itemLocker.relock();
const int count = m_itemStates.count();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic