fix problem if _should_write is called by expired timer after
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 08 Sep 2017 11:53:48 +0300
changeset 1795 e27d253bd0ba
parent 1794 e31d5a36d1f3
child 1796 4f7a0c40a7c3
fix problem if _should_write is called by expired timer after
termination of wx application.
BeremizIDE.py
--- a/BeremizIDE.py	Mon Aug 28 10:49:53 2017 +0000
+++ b/BeremizIDE.py	Fri Sep 08 11:53:48 2017 +0300
@@ -163,9 +163,11 @@
             self.TimerAccessLock.release()
 
     def _should_write(self):
-        wx.CallAfter(self._write)
+        app = wx.GetApp()
+        if app is not None:
+            wx.CallAfter(self._write)
+
         if MainThread == currentThread().ident:
-            app = wx.GetApp()
             if app is not None:
                 if self.YieldLock.acquire(0):
                     app.Yield()