summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2011-11-18 00:53:17 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2011-11-20 18:00:12 +0000
commitf0c4a4c76604ddb9b7fdf20f9d9f1c5f7111df75 (patch)
treeabcfb079de5a0ab3fa0b1b393daa98f4f792aeab
parent683e4be529b5d45e961abfc5530b0676e8ad9a8b (diff)
downloaddeluge-f0c4a4c76604ddb9b7fdf20f9d9f1c5f7111df75.zip
deluge-f0c4a4c76604ddb9b7fdf20f9d9f1c5f7111df75.tar.gz
deluge-f0c4a4c76604ddb9b7fdf20f9d9f1c5f7111df75.tar.bz2
Fix #1928 : Crash when dragging column header
The fix specifically applied to on_alert_save_resume_data by moving function call str(alert.handle.info_hash()) into the try statement. For completeness any calls to str(alert.handle.info_hash()) also moved into try statements.
-rw-r--r--deluge/core/torrentmanager.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index 545959c..ff6ba4f 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -17,9 +17,9 @@
#
# You should have received a copy of the GNU General Public License
# along with deluge. If not, write to:
-# The Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor
-# Boston, MA 02110-1301, USA.
+# The Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor
+# Boston, MA 02110-1301, USA.
#
# In addition, as a special exception, the copyright holders give
# permission to link the code of portions of this program with the OpenSSL
@@ -149,7 +149,7 @@ class TorrentManager(component.Component):
# Keeps track of resume data that needs to be saved to disk
self.resume_data = {}
-
+
# Workaround to determine if TorrentAddedEvent is from state file
self.session_started = False
@@ -419,7 +419,7 @@ class TorrentManager(component.Component):
if options["mapped_files"]:
for index, filename in options["mapped_files"].items():
filename = deluge.core.torrent.sanitize_filepath(filename)
- log.debug("renaming file index %s to %s", index, filename)
+ log.debug("renaming file index %s to %s", index, filename)
torrent_info.rename_file(index, utf8_encoded(filename))
add_torrent_params["ti"] = torrent_info
@@ -856,9 +856,9 @@ class TorrentManager(component.Component):
log.debug("on_alert_torrent_finished")
try:
torrent = self.torrents[str(alert.handle.info_hash())]
+ torrent_id = str(alert.handle.info_hash())
except:
return
- torrent_id = str(alert.handle.info_hash())
log.debug("%s is finished..", torrent_id)
# Get the total_download and if it's 0, do not move.. It's likely
@@ -891,9 +891,9 @@ class TorrentManager(component.Component):
log.debug("on_alert_torrent_paused")
try:
torrent = self.torrents[str(alert.handle.info_hash())]
+ torrent_id = str(alert.handle.info_hash())
except:
return
- torrent_id = str(alert.handle.info_hash())
# Set the torrent state
old_state = torrent.state
torrent.update_state()
@@ -985,9 +985,9 @@ class TorrentManager(component.Component):
log.debug("on_alert_torrent_resumed")
try:
torrent = self.torrents[str(alert.handle.info_hash())]
+ torrent_id = str(alert.handle.info_hash())
except:
return
- torrent_id = str(alert.handle.info_hash())
torrent.is_finished = torrent.handle.is_seed()
old_state = torrent.state
torrent.update_state()
@@ -1012,10 +1012,8 @@ class TorrentManager(component.Component):
def on_alert_save_resume_data(self, alert):
log.debug("on_alert_save_resume_data")
-
- torrent_id = str(alert.handle.info_hash())
-
try:
+ torrent_id = str(alert.handle.info_hash())
torrent = self.torrents[torrent_id]
except:
return
@@ -1046,9 +1044,9 @@ class TorrentManager(component.Component):
log.debug("index: %s name: %s", alert.index, alert.name.decode("utf8"))
try:
torrent = self.torrents[str(alert.handle.info_hash())]
+ torrent_id = str(alert.handle.info_hash())
except:
return
- torrent_id = str(alert.handle.info_hash())
# We need to see if this file index is in a waiting_on_folder list
folder_rename = False
@@ -1090,6 +1088,9 @@ class TorrentManager(component.Component):
def on_alert_file_completed(self, alert):
log.debug("file_completed_alert: %s", alert.message())
- torrent_id = str(alert.handle.info_hash())
+ try:
+ torrent_id = str(alert.handle.info_hash())
+ except:
+ return
component.get("EventManager").emit(
TorrentFileCompletedEvent(torrent_id, alert.index))