From 7e71de558adab5e23098552d357da44fa57d70b0 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Mon, 17 Aug 2009 06:01:35 +0000 Subject: [PATCH] - catching invalid_handle exception to avoid rare crashes --- src/GUI.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index 752b3b43c..d47910367 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -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."); } } }