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

Big font_size crashes kivy/python process with exit code -1073741784 (0xC0000028) STATUS_BAD_STACK #7914

Closed
CoreTaxxe opened this issue Jul 16, 2022 · 2 comments

Comments

@CoreTaxxe
Copy link

CoreTaxxe commented Jul 16, 2022

Software Versions

  • Python: 3.9.5
  • OS: Windows 11 (10.0.22000)
  • Kivy: 2.1.0
  • Kivy installation method: pip

Describe the bug

It might be related to #7899.

Setting a big font size for widgets causes the Kivy/Python process to crash without any python error. The process finishes with exit code -1073741784 (0xC0000028) which is STATUS_BAD_STACK. The max value for font sizes varies from font to font but is around 877 for most common ones. I think a memory error is not the issue since the ram never exceeds 50 MB in the MRE.

Expected behavior
Setting big fonts should display the fonts correctly or throw a fitting error.

To Reproduce

  1. Create any text related widget.
  2. Set a big font size (~>870)

Code and Logs and screenshots

from kivy.app import App
from kivy.uix.label import Label

class TestApp(App):

    def build(self):
        return Label(text="text", font_size=1000)

TestApp().run()

Edit :

It appears as this issue not only happens with large font sizes but some specific sizes as well.

from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.clock import Clock
from kivy.core.text import FontContextManager as FCM


class F(FloatLayout):
    faulty_sizes: list[int, ...] = [
        103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
        195, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
        218, 219, 220, 221, 222, ... 
    ]

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.l = Label(text="Hello World", font_size = 1)
        self.add_widget(self.l)

        Clock.schedule_once(self.check_size, 1)

    def check_size(self, dt=0) -> None:
        new_size: float = self.l.font_size + 1
        while new_size in self.faulty_sizes:
            new_size += 1
        print(f"checking size : {new_size}")
        self.l.font_size = new_size
        Clock.schedule_once(self.check_size)


class MyApp(App):
    def build(self):
        return F()


MyApp().run()

Edit 2: Since its "fixed" by

import os
os.environ['KIVY_TEXT'] = 'pil'

and since its an SDL Issue I'm going to close this one.

(SDL ttf cant handle font sizes that exceed the area they are rendered on I think)

@T-Dynamos
Copy link

image
Works fine ?

@imcrazeegamer
Copy link

I have the same issue on windows 10 and i had a friend run the same code on Linux and it worked for him so its probably a windows exclusive problem
same error code same python version and same Kivy version

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

3 participants