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

app crash on close #734

Closed
jligeza opened this issue May 6, 2016 · 6 comments
Closed

app crash on close #734

jligeza opened this issue May 6, 2016 · 6 comments

Comments

@jligeza
Copy link

jligeza commented May 6, 2016

When I exit my app (app.stop()), a strange segmentation error occurs: http://pastebin.com/F8HEaeip

This is with sdl2 and kivy 1.9.2 dev.
It works fine with pygame, what makes me puzzled.

The requirements list:
requirements = openssl,geopy,plyer,android,tinydb,hostpython2,kivy==master

What could be the reason of this crash?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@inclement
Copy link
Member

I don't have any insight into this, I guess it needs some active debugging. If the segfault is happening during kivy's internal stop process then that's probably the first place to look.

@cidermole
Copy link
Contributor

cidermole commented Aug 12, 2016

Here's the problem I experienced (with crash in the same place):

Nobody destroys the app Window by default. Then long after Python is gone ("Python for android ended."), Java will call back via Activity.onPause() into SDL native code, which then references a stale Android_Window in Java_org_libsdl_app_SDLActivity_nativePause().

Workaround:

You must call WindowSDL.close() before the app exits the main EventLoop.

An ideal way to do this is to handle the event in App.on_stop():

from kivy.app import App
from kivy.core.window import Window

class MyFancyApplication(App):
    def on_stop(self):
        Window.close()

# ...

# somewhere else:
App.get_running_app().stop()

@cidermole
Copy link
Contributor

cidermole commented Aug 12, 2016

@inclement can you provide details about the basic kivy shutdown design? I guess that the event should be bound to something which cleans up the window without needing user code?

@gooroopy
Copy link

@cidermole I've also spent a few hours to fixed this issue a couple week ago, this is my patch :- http://pastebin.com/JthasWiG

@inclement I will submit PR to Kivy if this is make sense.

@inclement
Copy link
Member

@gooroopy Sorry for the delay replying, and thanks a lot for the patch! I'm not familiar with this part of Kivy's internals, but if you didn't do so already it would be very welcome to open a PR in the kivy repo for it.

@inclement
Copy link
Member

I believe this is no longer happening on p4a master. Recently I was testing this type of thing while getting pause to work with sdl2.0.9

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

No branches or pull requests

4 participants