Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxOverlay on mac causes crash on shutdown if not deleted before shutting down. #2450

Open
ChrisBarker-NOAA opened this issue Aug 23, 2023 · 0 comments

Comments

@ChrisBarker-NOAA
Copy link

wxMac -- a couple versions, but currently: 11.7.9

wxPython version & source: 4.2.1 from conda-forge (but antoher user has reported on 4.2.0 and from PyPi, I think)

Python version & source: Python 3.9 and 3.10 -- conda-forge (but others have reported it on other builds)

Description of the problem:->

If there is a wx.Overlay still around when the app shuts down, you get a segfault on closing it.

 line 3: 10056 Segmentation fault: 11  /Users/chris.barker/miniconda3/envs/floatcanvas/python.app/Contents/MacOS/python "$@"

The solution is to delete the wx.DCOverlay before clearing the wx.Overlay. Here's the code that works, in lib.floatcanvas.GUI RubberBandBox (in #2448):

  odc = wx.DCOverlay(self.overlay, dc)
  del odc  # needs to be deleted before clearing the overlay, or it will crash on exit
  self.overlay.Reset()

without that del -- it crashes on exit, and trying to delete the wx.Overlay instead is ugly -- I had to do it in a wx.CallAfter (probably because the wx.DCOverlay was still around)

Not too bad to work around once I figure it out, but ideally it should not be possible to get a segfault with Python code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant