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 3493 ff25207ec303
parent 3492 cf6d6e033c86
child 3494 435259844a64
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