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

Crash on "--orientation sensor" when rotate #1797

Closed
RobertFlatt opened this issue Apr 19, 2019 · 2 comments
Closed

Crash on "--orientation sensor" when rotate #1797

RobertFlatt opened this issue Apr 19, 2019 · 2 comments

Comments

@RobertFlatt
Copy link
Contributor

Versions

  • Python: 3.6.7
  • OS: Ubuntu 18.04
  • Kivy: master
  • Cython: 29.1

Description

This seems to be a recurrence of an issue that has been closed more than once. #148 #730

Intermittent crash on "--orientation sensor" when phone rotated. Usually occurs within 3 rotates.
Removing the Window.bind() call disables the crash, but removes functionality

Adding a delay is a workaround, I don't know how reliable yet.
Window.bind(size=Clock.schedule_once(self._resize_handler, 0.1))
A delay of 0.01 still crashes.
Thanks @inclement for the suggestion

from kivy.app import App
from kivy.uix.label import Label
from kivy.graphics import Color, Rectangle
from kivy.core.window import Window

class Demo(App):
    def set_background_color(self):
        with self.label.canvas.before:
            Color(0.5, 0.0, 0.5)
            Rectangle(size=Window.size) 

    def _resize_handler(self,obj,size):
        self.set_background_color()

    def build(self):
        Window.bind(size=self._resize_handler)
        self.label = Label(text = 'Greetings Earthlings')
        self.set_background_color()
        return self.label

if __name__ == '__main__':
    Demo().run()

buildozer.spec

Command:

p4a apk

Spec file:

--dist_name=ex
--private .
--package=com.fishes.ex
--name Ex
--requirements=python3,kivy==master
--arch=armeabi-v7a
--orientation sensor
--sdk_dir /home/bobf/androidtools/sdk
--ndk_dir /home/bobf/androidtools/android-ndk-r17c
--android_api 28
--ndk-api 21
--version 0.0.9

Logs

Logcat attached
logcat.txt
Phone is Pixel3
The tail of the backtrace says:

04-18 10:09:30.879 11590 11590 F DEBUG   :     #07 pc 000080e3  /data/data/com.example.ex/files/app/_python_bundle/site-packages/kivy/graphics/vbo.so
04-18 10:09:30.884   621   621 E libc    : Access denied finding property "vendor.debug.egl.swapinterval"
@inclement
Copy link
Member

Thanks for the report, I think this is actually probably a different issue to the historical ones you mentioned, and it's good to know the specific cause relating to binding to Window when Window may not exist properly.

I suspect this needs a fix in Kivy itself, so I opened kivy/kivy#6277 about it.

@RobertFlatt
Copy link
Contributor Author

Fixed by the kivy/kivy#6277 fix. :)

I tested using kivy==master and the test app above, and also using a large app [after removing the Clock.schedule_once() workaround in both apps].
Both worked perfectly 'on rotate'. An 'on resume' crash is gone too.

Big thanks all involved.

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

2 participants