diff --git a/ChangeLog b/ChangeLog index 0f010908f..1077fbfea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,10 @@ would keep updating one call after the other. If the value changed, the timer is now stopped and restarted using the new value. +=== Deluge 1.3.6 (In Development) === +==== Core ==== + * Catch & log KeyError when removing a torrent from the queued torrents set + === Deluge 1.3.5 (09 April 2012) === ==== GtkUI ==== * Modified fix for #1957, keyerror with non-acsii columns diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 49db2c112..24a3dfbc8 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -633,7 +633,10 @@ class TorrentManager(component.Component): # Remove from set if it wasn't finished if not self.torrents[torrent_id].is_finished: - self.queued_torrents.remove(torrent_id) + try: + self.queued_torrents.remove(torrent_id) + except KeyError: + log.debug("%s isn't in queued torrents set?", torrent_id) # Remove the torrent from deluge's session try: @@ -951,7 +954,11 @@ class TorrentManager(component.Component): torrent.update_state() # Torrent is no longer part of the queue - self.queued_torrents.remove(torrent_id) + try: + self.queued_torrents.remove(torrent_id) + except KeyError: + # Sometimes libtorrent fires a TorrentFinishedEvent twice + log.debug("%s isn't in queued torrents set?", torrent_id) # Only save resume data if it was actually downloaded something. Helps # on startup with big queues with lots of seeding torrents. Libtorrent