summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2011-11-20 17:27:10 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2011-11-20 18:00:18 +0000
commit2504b2520a9554d01e85a786c5c102d0f591a68c (patch)
tree2d10a9243915adcd5753103162cf0635788788c6
parentd8560f5c259c98c4f28f0ec364bcfd76fd81183e (diff)
downloaddeluge-2504b252.zip
deluge-2504b252.tar.gz
deluge-2504b252.tar.bz2
Fix #1964 : Unhandled UnpicklingError with corrupt state file
-rw-r--r--deluge/core/torrentmanager.py6
-rw-r--r--deluge/ui/gtkui/files_tab.py2
-rw-r--r--deluge/ui/gtkui/listview.py6
-rw-r--r--deluge/ui/gtkui/peers_tab.py8
-rw-r--r--deluge/ui/gtkui/torrentdetails.py8
5 files changed, 15 insertions, 15 deletions
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index c49e8c9..996f5c4 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -608,7 +608,7 @@ class TorrentManager(component.Component):
os.path.join(get_config_dir(), "state", "torrents.state"), "rb")
state = cPickle.load(state_file)
state_file.close()
- except (EOFError, IOError, Exception), e:
+ except (EOFError, IOError, Exception, cPickle.UnpicklingError), e:
log.warning("Unable to load state file: %s", e)
# Try to use an old state
@@ -683,8 +683,8 @@ class TorrentManager(component.Component):
state_file.flush()
os.fsync(state_file.fileno())
state_file.close()
- except IOError:
- log.warning("Unable to save state file.")
+ except IOError, e:
+ log.warning("Unable to save state file: %s", e)
return True
# We have to move the 'torrents.state.new' file to 'torrents.state'
diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py
index 468ab98..45f819f 100644
--- a/deluge/ui/gtkui/files_tab.py
+++ b/deluge/ui/gtkui/files_tab.py
@@ -281,7 +281,7 @@ class FilesTab(Tab):
state_file = open(os.path.join(config_location, filename), "rb")
state = cPickle.load(state_file)
state_file.close()
- except (EOFError, IOError, AttributeError), e:
+ except (EOFError, IOError, AttributeError, cPickle.UnpicklingError), e:
log.warning("Unable to load state file: %s", e)
if state == None:
diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
index a687211..4bf016c 100644
--- a/deluge/ui/gtkui/listview.py
+++ b/deluge/ui/gtkui/listview.py
@@ -295,7 +295,7 @@ class ListView:
state_file = open(os.path.join(config_location, filename), "rb")
state = cPickle.load(state_file)
state_file.close()
- except (EOFError, IOError), e:
+ except (EOFError, IOError, cPickle.UnpicklingError), e:
log.warning("Unable to load state file: %s", e)
# Keep the state in self.state so we can access it as we add new columns
@@ -531,12 +531,12 @@ class ListView:
column.set_visible(column_state.visible)
position = column_state.position
break
-
+
# Set this column to not visible if its not in the state and
# its not supposed to be shown by default
if not column_in_state and not default and not hidden:
column.set_visible(False)
-
+
if position is not None:
self.treeview.insert_column(column, position)
else:
diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py
index bb2316f..6b2cf9a 100644
--- a/deluge/ui/gtkui/peers_tab.py
+++ b/deluge/ui/gtkui/peers_tab.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
@@ -212,7 +212,7 @@ class PeersTab(Tab):
state_file = open(os.path.join(config_location, filename), "rb")
state = cPickle.load(state_file)
state_file.close()
- except (EOFError, IOError, AttributeError), e:
+ except (EOFError, IOError, AttributeError, cPickle.UnpicklingError), e:
log.warning("Unable to load state file: %s", e)
if state == None:
diff --git a/deluge/ui/gtkui/torrentdetails.py b/deluge/ui/gtkui/torrentdetails.py
index 035e3ac..308dbeb 100644
--- a/deluge/ui/gtkui/torrentdetails.py
+++ b/deluge/ui/gtkui/torrentdetails.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
@@ -431,7 +431,7 @@ class TorrentDetails(component.Component):
state_file = open(os.path.join(config_location, filename), "rb")
state = cPickle.load(state_file)
state_file.close()
- except (EOFError, IOError), e:
+ except (EOFError, IOError, cPickle.UnpicklingError), e:
log.warning("Unable to load state file: %s", e)
return state