diff --git a/src/deluge.py b/src/deluge.py index 2f0bb16ac..28de25171 100644 --- a/src/deluge.py +++ b/src/deluge.py @@ -314,14 +314,6 @@ class Manager: self.remove_torrent_ns(unique_ID) self.sync() - # Remove .torrent and .fastresume - os.remove(temp.filename) - try: - # Must be after removal of the torrent, because that saves a new .fastresume - os.remove(temp.filename + ".fastresume") - except OSError: - pass # Perhaps there never was one to begin with - # Remove data, if asked to do so if data_also: # Must be done AFTER the torrent is removed @@ -640,9 +632,17 @@ class Manager: to_delete.append(unique_ID) for unique_ID in to_delete: + temp = self.unique_IDs[unique_ID] self.state.torrents.remove(self.unique_IDs[unique_ID]) self.state.queue.remove(unique_ID) del self.unique_IDs[unique_ID] + # Remove .torrent and .fastresume + os.remove(temp.filename) + try: + # Must be after removal of the torrent, because that saves a new .fastresume + os.remove(temp.filename + ".fastresume") + except OSError: + pass # Perhaps there never was one to begin with # Add torrents to queue - at the end, of course for unique_ID in self.unique_IDs.keys():