IDE: Workaround exception caused by dead C/C++ swig-wrapped object when debug still try to update view after close.
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 23 May 2022 18:10:13 +0200
changeset 3476 46a7aac382ef
parent 3475 ee665dca07fa
child 3477 9ec5ecf9f589
IDE: Workaround exception caused by dead C/C++ swig-wrapped object when debug still try to update view after close.
ProjectController.py
--- a/ProjectController.py	Mon May 23 16:27:56 2022 +0200
+++ b/ProjectController.py	Mon May 23 18:10:13 2022 +0200
@@ -1722,10 +1722,16 @@
             for weakcallable, buffer_list in WeakCallableDict.iteritems():
                 function = getattr(weakcallable, function_name, None)
                 if function is not None:
-                    if buffer_list:
-                        function(*cargs)
-                    else:
-                        function(*tuple([lst[-1] for lst in cargs]))
+                    # FIXME: apparently, despite of weak ref objects,
+                    # some dead C/C++ wx object are still reachable from here
+                    # leading to RuntimeError exception
+                    try:
+                        if buffer_list:
+                            function(*cargs)
+                        else:
+                            function(*tuple([lst[-1] for lst in cargs]))
+                    except RuntimeError:
+                        pass
 
     def GetTicktime(self):
         return self._Ticktime