title: pyobjc and wx crash when program exits ends
body: <p>Similar to this question <a href="https://stackoverflow.com/questions/19407570/wxpython-pyobjc-causes-app-to-crash-at-the-end">wxPython + PyObjC causes app to crash at the end</a> however there code has more superfluous code.</p>
  
  <p>I have the following two samples of code, the latter crashes the former runs fine.</p>
  
  <p><strong>The only difference in the code is the order of the imports.</strong></p>
  
  <h2><strong>This code runs fine.</strong></h2>
  
  <pre><code>import time
  
  # note that the line is before this is so the code does work this is the only
  # change that seems to matter
  # need the following line to be AFTER wx import otherwise runs fine
  import objc # or import Foundation or probably any objc library
  
  import wx
  
  
  
  # need the following line
  app = wx.App(redirect=False)
  
  # sleep shows it is ONLY when the code finally ends not before
  time.sleep(3)
  # you don't even need the MainLoop call
  </code></pre>
  
  <h2><strong>This code runs segfaults when program stops running.</strong></h2>
  
  <pre><code>import time
  
  import wx
  # need this line to be AFTER wx import otherwise runs fine
  import objc # or import Foundation or probably any objc library
  
  
  # need the following line
  app = wx.App(redirect=False)
  
  # sleep shows it is ONLY when the code finally ends not before
  time.sleep(3)
  # you don't even need the MainLoop call
  </code></pre>
  
  <h2><strong>How to replicate</strong></h2>
  
  <ol>
  <li>Make sure pyobjc is installed and you can import objc</li>
  <li>Make sure wxPython is installed (it seems both 2.9 and 3.0 are effected)</li>
  <li>run command python <em>file</em></li>
  </ol>