Skip to content

Commit

Permalink
- Added some checking before adding torrents to finished/download lis…
Browse files Browse the repository at this point in the history
…ts to avoid duplicate in some circumstances
  • Loading branch information
Christophe Dumez committed Aug 19, 2007
1 parent a01c7e2 commit a4a98e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/FinishedTorrents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ FinishedTorrents::~FinishedTorrents(){
}

void FinishedTorrents::addFinishedTorrent(QString hash){
int row = finishedListModel->rowCount();
int row = getRowFromHash(hash);
if(row != -1) return;
row = finishedListModel->rowCount();
torrent_handle h = BTSession->getTorrentHandle(hash);
// Adding torrent to download list
finishedListModel->insertRow(row);
Expand Down
4 changes: 3 additions & 1 deletion src/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,10 @@ unsigned int GUI::getCurrentTabIndex() const{
}

void GUI::restoreInDownloadList(torrent_handle h){
unsigned int row = DLListModel->rowCount();
QString hash = QString(misc::toString(h.info_hash()).c_str());
int row = getRowFromHash(hash);
if(row != -1) return;
row = DLListModel->rowCount();
// Adding torrent to download list
DLListModel->insertRow(row);
DLListModel->setData(DLListModel->index(row, NAME), QVariant(h.name().c_str()));
Expand Down

0 comments on commit a4a98e3

Please sign in to comment.