diff options
| author | Simeon Bird <[email protected]> | 2013-01-12 10:37:26 -0500 |
|---|---|---|
| committer | Simeon Bird <[email protected]> | 2013-01-15 11:11:59 -0500 |
| commit | 7fe1278b1e2aaec2408bf053092f8f11ef4cbfdb (patch) | |
| tree | c5208032532e2d4596c4985e0116dca72a3873fa /src/views/versioncontrol/versioncontrolobserver.cpp | |
| parent | 72de114a94c9a8d313c517a694be63662a7d10c2 (diff) | |
We don't need the mutex guarding m_itemStates in the
UpdateItemStatesThread, because m_itemStates is only accessed by the
when the thread is done, and set before the thread starts.
Also combine the setData function with the constructor.
Diffstat (limited to 'src/views/versioncontrol/versioncontrolobserver.cpp')
| -rw-r--r-- | src/views/versioncontrol/versioncontrolobserver.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index 64bc26867..f4dd877d3 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -238,20 +238,12 @@ void VersionControlObserver::slotThreadFinished() void VersionControlObserver::updateItemStates() { Q_ASSERT(m_plugin); - if (!m_updateItemStatesThread) { - m_updateItemStatesThread = new UpdateItemStatesThread(); - connect(m_updateItemStatesThread, SIGNAL(finished()), - this, SLOT(slotThreadFinished())); - connect(m_updateItemStatesThread, SIGNAL(finished()), - m_updateItemStatesThread, SLOT(deleteLater())); - } - else { + if (m_updateItemStatesThread) { // An update is currently ongoing. Wait until the thread has finished // the update (see slotThreadFinished()). m_pendingItemStatesUpdate = true; return; } - QList<ItemState> itemStates; const int itemCount = m_model->count(); itemStates.reserve(itemCount); @@ -269,7 +261,12 @@ void VersionControlObserver::updateItemStates() if (!m_silentUpdate) { emit infoMessage(i18nc("@info:status", "Updating version information...")); } - m_updateItemStatesThread->setData(m_plugin, itemStates); + m_updateItemStatesThread = new UpdateItemStatesThread(m_plugin, itemStates); + connect(m_updateItemStatesThread, SIGNAL(finished()), + this, SLOT(slotThreadFinished())); + connect(m_updateItemStatesThread, SIGNAL(finished()), + m_updateItemStatesThread, SLOT(deleteLater())); + m_updateItemStatesThread->start(); // slotThreadFinished() is called when finished } } |
