┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/versioncontrol/updateitemstatesthread.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-11-06 16:27:19 +0000
committerPeter Penz <[email protected]>2009-11-06 16:27:19 +0000
commit8fbb88475517cb055617ba375c8f0747f6f646e7 (patch)
tree239129817749d092d2f5803e156f9c8ede4fab7b /src/versioncontrol/updateitemstatesthread.cpp
parent896ee459af10c73d20d0ae093b4c02348ffedb18 (diff)
Fixed issues when several LoadItemStatesThreads access one plugin or when the VersionControlObserver is deleted during thread execution.
svn path=/trunk/KDE/kdebase/apps/; revision=1045694
Diffstat (limited to 'src/versioncontrol/updateitemstatesthread.cpp')
-rw-r--r--src/versioncontrol/updateitemstatesthread.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/versioncontrol/updateitemstatesthread.cpp b/src/versioncontrol/updateitemstatesthread.cpp
index 7483e056e..3ac74a11b 100644
--- a/src/versioncontrol/updateitemstatesthread.cpp
+++ b/src/versioncontrol/updateitemstatesthread.cpp
@@ -19,12 +19,14 @@
#include "updateitemstatesthread.h"
-UpdateItemStatesThread::UpdateItemStatesThread(QObject* parent) :
- QThread(parent),
+UpdateItemStatesThread::UpdateItemStatesThread() :
+ QThread(),
m_retrievedItems(false),
- m_mutex(QMutex::Recursive),
+ m_mutex(0),
m_itemStates()
{
+ static QMutex globalMutex;
+ m_mutex = &globalMutex;
}
UpdateItemStatesThread::~UpdateItemStatesThread()
@@ -49,7 +51,7 @@ void UpdateItemStatesThread::run()
// VersionControlObserver::addDirectory() to be sure that the last item contains the root.
const QString directory = m_itemStates.last().item.url().directory(KUrl::AppendTrailingSlash);
- QMutexLocker locker(&m_mutex);
+ QMutexLocker locker(m_mutex);
m_retrievedItems = false;
if (m_plugin->beginRetrieval(directory)) {
const int count = m_itemStates.count();
@@ -63,12 +65,12 @@ void UpdateItemStatesThread::run()
bool UpdateItemStatesThread::beginReadItemStates()
{
- return m_mutex.tryLock(300);
+ return m_mutex->tryLock(300);
}
void UpdateItemStatesThread::endReadItemStates()
{
- m_mutex.unlock();
+ m_mutex->unlock();
}
QList<VersionControlObserver::ItemState> UpdateItemStatesThread::itemStates() const