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

Mac examples exit with error code 255 #162

Closed
GoogleCodeExporter opened this issue Aug 28, 2015 · 5 comments
Closed

Mac examples exit with error code 255 #162

GoogleCodeExporter opened this issue Aug 28, 2015 · 5 comments
Labels
Milestone

Comments

@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Aug 28, 2015

All examples have such OnClose event:

OnClose():
    self.Destroy()
    cefpython.Shutdown()
    wx.GetApp().Exit()

I don't know any other way to exit wx app on mac. If Exit() call is removed
then there is error: "Segmentation fault: 11".

Original issue reported on code.google.com by [email protected] on 13 Jan 2015 at 2:20

@kollivier
Copy link

I just ran across this issue and I wanted to note that I was able to fix it by calling cefpython.ShutDown() before destroying the wx window, rather than after. I suspect what is happening is that in a single-window app, window.Destroy() also leads to the app's main loop being destroyed, which IIRC on Mac destroys the app's NSAutoreleasePool as well. Then when cefpython tries to pop the NSAutoreleasePool to trigger garbage collection, it crashes because the NSAutoreleasePool doesn't exist any longer.

@cztomczak
Copy link
Owner

@kollivier I tried your suggestion, but it doesn't work for me in CEF v56.0 when running the new wxpython.py example.

For reference, a similar issue was reported on CEF Forum here:
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=13737

@cztomczak
Copy link
Owner

Fixed it with such code in OnClose in v56:

        if MAC:
            # On Mac things work differently, other steps are required
            self.browser.CloseBrowser()
            self.clear_browser_references()
            self.Destroy()
            global g_count_windows
            g_count_windows -= 1
            if g_count_windows == 0:
                cef.Shutdown()
                wx.GetApp().ExitMainLoop()
                # Call _exit otherwise app exits with code 255 (Issue #162).
                # noinspection PyProtectedMember
                os._exit(0)

cztomczak added a commit that referenced this issue Mar 1, 2017
Add comment about tkinter_.py example not working on Mac.

Delete deprecated Mac examples.
@cztomczak cztomczak added this to the v56 milestone Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants