- catching invalid_handle exception to avoid rare crashes

This commit is contained in:
Christophe Dumez 2009-08-17 06:01:35 +00:00
parent 09d8a4797d
commit 7e71de558a

View file

@ -1431,16 +1431,20 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(!h.is_valid()) continue;
if(h.is_seed()) {
// Update in finished list
finishedTorrentTab->updateTorrent(h);
} else {
// Update in download list
if(downloadingTorrentTab->updateTorrent(h)) {
// Torrent was added, we may need to remove it from finished tab
finishedTorrentTab->deleteTorrent(h.hash());
TorrentPersistentData::saveSeedStatus(h);
try {
if(h.is_seed()) {
// Update in finished list
finishedTorrentTab->updateTorrent(h);
} else {
// Update in download list
if(downloadingTorrentTab->updateTorrent(h)) {
// Torrent was added, we may need to remove it from finished tab
finishedTorrentTab->deleteTorrent(h.hash());
TorrentPersistentData::saveSeedStatus(h);
}
}
} catch(invalid_handle e) {
qDebug("Caught Invalid handle exception, lucky us.");
}
}
}