From b619c9d427704484ef12ff3288ecbb69bbbedd87 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 23 Apr 2010 21:46:28 -0500 Subject: [PATCH] If Disconnect comes between start of Connect and getting a response back from google's website, then everything would be canceled and we go through the disconnect code path. Sadly this means we save the cache even though we never loaded it. This would then cause old messages to be displayed as new. Watching for empty caches and treating it as if the cache didn't exist --- src/gvoice/conversations.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gvoice/conversations.py b/src/gvoice/conversations.py index b48887e..ed10b9c 100644 --- a/src/gvoice/conversations.py +++ b/src/gvoice/conversations.py @@ -47,7 +47,7 @@ class Conversations(object): _moduleLogger.exception("While loading for %s" % self._name) return - if misc_utils.compare_versions( + if convs and misc_utils.compare_versions( self.OLDEST_COMPATIBLE_FORMAT_VERSION, misc_utils.parse_version(fileVersion), ) <= 0: @@ -70,6 +70,10 @@ class Conversations(object): def save(self, path): _moduleLogger.info("%s Saving cache" % (self._name, )) + if not self._conversations: + _moduleLogger.info("%s Odd, no conversations to cache. Did we never load the cache?" % (self._name, )) + return + try: dataToDump = (constants.__version__, constants.__build__, self._conversations) with open(path, "wb") as f: -- 1.7.9.5