Skip to content

app crash on close #734

Closed
Closed

Description

@jligeza

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.

Activity

  1. inclement commented on May 7, 2016

    @inclement
    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.

  2. cidermole commented on Aug 12, 2016

    @cidermole
    Contributor

    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()
    
  3. cidermole commented on Aug 12, 2016

    @cidermole
    Contributor

    @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?

  4. gooroopy commented on Aug 13, 2016

    @gooroopy

    @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.

  5. inclement commented on Aug 31, 2016

    @inclement
    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.

  6. inclement commented on Jan 30, 2019

    @inclement
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions