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.
This commit is contained in:
Calum Lind 2011-11-18 00:53:17 +00:00
parent 683e4be529
commit f0c4a4c766
1 changed files with 14 additions and 13 deletions

View File

@ -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())
try:
torrent_id = str(alert.handle.info_hash())
except:
return
component.get("EventManager").emit(
TorrentFileCompletedEvent(torrent_id, alert.index))