Edge case - Snackbar somehow causes ReferenceError on window resize while active
Test-case below. Basically when you first start the app below, you can freely resize it. But when you click the button (bringing the snackbar up) and then repeatedly resize the window there's some sort of race condition going on which raises a ReferenceError: weakly-referenced object no longer exists
It's a bit harder to trigger with this simple code, but in my own app with a lot more going on the triggering is just about 100% every time I call the Snackbar. A trace indicates the error comes from line 32 (a humongous line for setting the snackbar's width), and git blame indicates the last edit on that was @ZingBallyhoo - if you can trigger the error could you take a look? I'll be taking a look myself, but just the number of characters there freaks me out.
EDIT: Actually I've found an easier way to trigger it (not sure if the cause is still the same) but clicking the button twice and then resizing the window crashes out.
import kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivymd import snackbar as Snackbar
Builder.load_string("""
<BaseWidget>:
Button:
text: 'Button'
on_press: root.toggle()
""")
class BaseWidget(BoxLayout):
def toggle(self):
Snackbar.make('test')
class TestApp(App):
def build(self):
self.base = BaseWidget()
return self.base
if __name__ == '__main__':
TestApp().run()