diff --git a/plover/oslayer/xkeyboardcontrol.py b/plover/oslayer/xkeyboardcontrol.py index 8177a30f4..04d76fb88 100644 --- a/plover/oslayer/xkeyboardcontrol.py +++ b/plover/oslayer/xkeyboardcontrol.py @@ -1172,6 +1172,7 @@ def __init__(self): super().start() def _on_event(self, event): + assert self._display_lock.locked() if event.type == X.MappingNotify: if event.request == X.MappingKeyboard: if event.count == 1: @@ -1188,11 +1189,11 @@ def _on_event(self, event): elif event.request == X.MappingModifier: self._update_modifiers() - @with_display_lock def _update_keymap(self): '''Analyse keymap, build a mapping of keysym to (keycode + modifiers), and find unused keycodes that can be used for unmapped keysyms. ''' + assert self._display_lock.locked() or not self.is_alive() self._keymap = {} self._custom_mappings_queue = [] # Analyse X11 keymap. @@ -1245,9 +1246,9 @@ def _update_keymap(self): assert self._backspace_mapping is not None assert self._backspace_mapping.custom_mapping is None - @with_display_lock def _update_modifiers(self): # Get modifier mapping. + assert self._display_lock.locked() or not self.is_alive() self.modifier_mapping = self._display.get_modifier_mapping() @with_display_lock @@ -1372,6 +1373,7 @@ def _get_mapping(self, keysym, automatically_map=True): keysym -- A key symbol. """ + assert self._display_lock.locked() or not self.is_alive() mapping = self._keymap.get(keysym) if mapping is None: # Automatically map?