From: Ed Page Date: Sat, 24 Apr 2010 02:46:28 +0000 (-0500) Subject: If Disconnect comes between start of Connect and getting a response back X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;ds=sidebyside;h=b619c9d427704484ef12ff3288ecbb69bbbedd87;p=theonering 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 --- 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: