[meld/meld-3-20] filediff: Handle our delete handler being called multiple times (#502)



commit 843fce6404d93c40010250c30509212ca75dc199
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Oct 3 14:56:53 2020 +1000

    filediff: Handle our delete handler being called multiple times (#502)
    
    This shouldn't happen in general, but if the document lifecycle gets out
    of step... it may. While this exception catch is ugly, a traceback here
    doesn't actually tell us anything and only serves to break things for
    the user.

 meld/filediff.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index a073cdbe..25056937 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -931,7 +931,10 @@ class FileDiff(MeldDoc, Component):
                 meldsettings.disconnect(h)
             # TODO: This should not be necessary; remove if and when we
             # figure out what's keeping MeldDocs alive for too long.
-            del self._cached_match
+            try:
+                del self._cached_match
+            except AttributeError:
+                pass
             # TODO: Base the return code on something meaningful for VC tools
             self.emit('close', 0)
         return response


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]