diff --git a/src/GUI.cpp b/src/GUI.cpp index f9b941b4a..253bb4f59 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -462,6 +463,7 @@ void GUI::sortProgressColumnDelayed() { void GUI::updateDlList(bool force){ char tmp[MAX_CHAR_TMP]; char tmp2[MAX_CHAR_TMP]; + QMutexLocker lock(&DLListAccess); // update global informations snprintf(tmp, MAX_CHAR_TMP, "%.1f", BTSession.getPayloadUploadRate()/1024.); snprintf(tmp2, MAX_CHAR_TMP, "%.1f", BTSession.getPayloadDownloadRate()/1024.); @@ -648,6 +650,7 @@ void GUI::sortDownloadListString(int index, Qt::SortOrder sortOrder){ } void GUI::sortDownloadList(int index, Qt::SortOrder startSortOrder, bool fromLoadColWidth){ + QMutexLocker lock(&DLListAccess); qDebug("Called sort download list"); static Qt::SortOrder sortOrder = startSortOrder; if(!fromLoadColWidth && downloadList->header()->sortIndicatorSection() == index){ diff --git a/src/GUI.h b/src/GUI.h index ec7305985..6fa0110a0 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -84,6 +85,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{ bool force_exit; bool delayedSorting; Qt::SortOrder delayedSortingOrder; + QMutex DLListAccess; // Preview previewSelect *previewSelection; QProcess *previewProcess; diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index fa225b04b..df3219c70 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -841,8 +841,8 @@ QStringList bittorrent::getUncheckedTorrentsList() const{ void bittorrent::setTorrentFinishedChecking(QString hash){ int index = torrentsUnchecked.indexOf(hash); + qDebug("torrent %s finished checking", (const char*)hash.toUtf8()); if(index != -1){ - qDebug("torrent %s finished checking", (const char*)hash.toUtf8()); torrentsUnchecked.removeAt(index); qDebug("Still %d unchecked torrents", torrentsUnchecked.size()); if(torrentsUnchecked.size() == 0){