Skip to content

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

@ChrisBarker-NOAA

Description

@ChrisBarker-NOAA

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions