Fixed cleanup race condition on browser page close

This commit is contained in:
Mark Qvist 2025-12-28 23:41:08 +01:00
parent 35910343fe
commit c4bf97dae2

View file

@ -37,19 +37,20 @@ class BrowserFrame(urwid.Frame):
if hasattr(self.delegate, "page_pile") and self.delegate.page_pile: if hasattr(self.delegate, "page_pile") and self.delegate.page_pile:
def df(loop, user_data): def df(loop, user_data):
st = None st = None
nf = self.delegate.page_pile.focus if self.delegate.page_pile:
if hasattr(nf, "key_timeout"): nf = self.delegate.page_pile.focus
st = nf if hasattr(nf, "key_timeout"):
elif hasattr(nf, "original_widget"): st = nf
no = nf.original_widget elif hasattr(nf, "original_widget"):
if hasattr(no, "original_widget"): no = nf.original_widget
st = no.original_widget if hasattr(no, "original_widget"):
else: st = no.original_widget
if hasattr(no, "key_timeout"): else:
st = no if hasattr(no, "key_timeout"):
st = no
if st and hasattr(st, "key_timeout") and hasattr(st, "keypress") and callable(st.keypress):
st.keypress(None, None) if st and hasattr(st, "key_timeout") and hasattr(st, "keypress") and callable(st.keypress):
st.keypress(None, None)
nomadnet.NomadNetworkApp.get_shared_instance().ui.loop.set_alarm_in(0.25, df) nomadnet.NomadNetworkApp.get_shared_instance().ui.loop.set_alarm_in(0.25, df)