소스 검색

wxGUI: fix atexit error in debug mode when exiting GUI (#772)

nilason 4 년 전
부모
커밋
afb11092b2
1개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. 5 6
      gui/wxpython/wxgui.py

+ 5 - 6
gui/wxpython/wxgui.py

@@ -22,7 +22,6 @@ from __future__ import print_function
 import os
 import sys
 import getopt
-import atexit
 
 # i18n is taken care of in the grass library code.
 # So we need to import it before any of the GUI code.
@@ -111,6 +110,11 @@ class GMApp(wx.App):
 
         return True
 
+        def OnExit(self):
+            """Clean up on exit"""
+            unregisterPid(os.getpid())
+            return super().OnExit()
+
 
 def printHelp():
     """ Print program help"""
@@ -137,10 +141,6 @@ def process_opt(opts, args):
     return workspaceFile
 
 
-def cleanup():
-    unregisterPid(os.getpid())
-
-
 def main(argv=None):
 
     if argv is None:
@@ -169,5 +169,4 @@ def main(argv=None):
     app.MainLoop()
 
 if __name__ == "__main__":
-    atexit.register(cleanup)
     sys.exit(main())