Skip to content

Commit

Permalink
Fix wrong nested locking
Browse files Browse the repository at this point in the history
  • Loading branch information
user202729 committed Apr 6, 2021
1 parent d1f7624 commit 6744da6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plover/oslayer/xkeyboardcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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?
Expand Down

0 comments on commit 6744da6

Please sign in to comment.