From 548b42ef20505512a325ca10d4e8980844a4fed7 Mon Sep 17 00:00:00 2001 From: dadav <33197631+dadav@users.noreply.github.com> Date: Sat, 30 Nov 2019 14:20:37 +0100 Subject: [PATCH] Lock ui on change --- pwnagotchi/plugins/default/bt-tether.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pwnagotchi/plugins/default/bt-tether.py b/pwnagotchi/plugins/default/bt-tether.py index 593fe16..face5a6 100644 --- a/pwnagotchi/plugins/default/bt-tether.py +++ b/pwnagotchi/plugins/default/bt-tether.py @@ -467,11 +467,13 @@ class BTTether(plugins.Plugin): self.ready = True def on_unload(self, ui): - ui.remove_element('bluetooth') + with ui._lock: + ui.remove_element('bluetooth') def on_ui_setup(self, ui): - ui.add_element('bluetooth', LabeledValue(color=BLACK, label='BT', value='-', position=(ui.width() / 2 - 15, 0), - label_font=fonts.Bold, text_font=fonts.Medium)) + with ui._lock: + ui.add_element('bluetooth', LabeledValue(color=BLACK, label='BT', value='-', position=(ui.width() / 2 - 15, 0), + label_font=fonts.Bold, text_font=fonts.Medium)) def on_ui_update(self, ui): if not self.ready: