mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
use a mutex for download list access (should fix sorting)
This commit is contained in:
parent
dcc54a7f35
commit
dfa9965ed3
3 changed files with 6 additions and 1 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
|
||||||
#include <libtorrent/extensions/metadata_transfer.hpp>
|
#include <libtorrent/extensions/metadata_transfer.hpp>
|
||||||
#include <libtorrent/extensions/ut_pex.hpp>
|
#include <libtorrent/extensions/ut_pex.hpp>
|
||||||
|
@ -462,6 +463,7 @@ void GUI::sortProgressColumnDelayed() {
|
||||||
void GUI::updateDlList(bool force){
|
void GUI::updateDlList(bool force){
|
||||||
char tmp[MAX_CHAR_TMP];
|
char tmp[MAX_CHAR_TMP];
|
||||||
char tmp2[MAX_CHAR_TMP];
|
char tmp2[MAX_CHAR_TMP];
|
||||||
|
QMutexLocker lock(&DLListAccess);
|
||||||
// update global informations
|
// update global informations
|
||||||
snprintf(tmp, MAX_CHAR_TMP, "%.1f", BTSession.getPayloadUploadRate()/1024.);
|
snprintf(tmp, MAX_CHAR_TMP, "%.1f", BTSession.getPayloadUploadRate()/1024.);
|
||||||
snprintf(tmp2, MAX_CHAR_TMP, "%.1f", BTSession.getPayloadDownloadRate()/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){
|
void GUI::sortDownloadList(int index, Qt::SortOrder startSortOrder, bool fromLoadColWidth){
|
||||||
|
QMutexLocker lock(&DLListAccess);
|
||||||
qDebug("Called sort download list");
|
qDebug("Called sort download list");
|
||||||
static Qt::SortOrder sortOrder = startSortOrder;
|
static Qt::SortOrder sortOrder = startSortOrder;
|
||||||
if(!fromLoadColWidth && downloadList->header()->sortIndicatorSection() == index){
|
if(!fromLoadColWidth && downloadList->header()->sortIndicatorSection() == index){
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
|
#include <QMutex>
|
||||||
|
|
||||||
#include <libtorrent/entry.hpp>
|
#include <libtorrent/entry.hpp>
|
||||||
#include <libtorrent/bencode.hpp>
|
#include <libtorrent/bencode.hpp>
|
||||||
|
@ -84,6 +85,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||||
bool force_exit;
|
bool force_exit;
|
||||||
bool delayedSorting;
|
bool delayedSorting;
|
||||||
Qt::SortOrder delayedSortingOrder;
|
Qt::SortOrder delayedSortingOrder;
|
||||||
|
QMutex DLListAccess;
|
||||||
// Preview
|
// Preview
|
||||||
previewSelect *previewSelection;
|
previewSelect *previewSelection;
|
||||||
QProcess *previewProcess;
|
QProcess *previewProcess;
|
||||||
|
|
|
@ -841,8 +841,8 @@ QStringList bittorrent::getUncheckedTorrentsList() const{
|
||||||
|
|
||||||
void bittorrent::setTorrentFinishedChecking(QString hash){
|
void bittorrent::setTorrentFinishedChecking(QString hash){
|
||||||
int index = torrentsUnchecked.indexOf(hash);
|
int index = torrentsUnchecked.indexOf(hash);
|
||||||
|
qDebug("torrent %s finished checking", (const char*)hash.toUtf8());
|
||||||
if(index != -1){
|
if(index != -1){
|
||||||
qDebug("torrent %s finished checking", (const char*)hash.toUtf8());
|
|
||||||
torrentsUnchecked.removeAt(index);
|
torrentsUnchecked.removeAt(index);
|
||||||
qDebug("Still %d unchecked torrents", torrentsUnchecked.size());
|
qDebug("Still %d unchecked torrents", torrentsUnchecked.size());
|
||||||
if(torrentsUnchecked.size() == 0){
|
if(torrentsUnchecked.size() == 0){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue