Closed
Description
Sample code causing deadlock:
import flet
from flet import Container, Page, Text, UserControl
class MyControl(UserControl):
def build(self):
print("i am built")
self.c = Container()
self.c.bgcolor = "blue"
self.c.content = Text("hello there")
return self.c
def did_mount(self):
print("i am mounted")
self.resize_me()
def resize_me(self):
self.c.bgcolor = "red"
self.update()
def main(page: Page):
t = MyControl()
page.add(t)
print("i am added")
flet.app(target=main)
Solution:
Go through a list of added controls after update()
is finished and lock released and call did_mount()
for each added control.