Repository navigation
Commit 9dd9cb0
Serialize X11 Display access in the Linux Ctrl-release poller
libX11 is not thread-safe (XInitThreads is not called), yet a single
Display connection was used unsynchronized from two threads: the poller
thread (XQueryKeymap, and XCloseDisplay on exit) and the main thread via
is_ctrl_down (XQueryKeymap). This raced the query against the close and
against itself, driving _XReply into a freed/corrupt buffer and crashing
plugin_host with SIGSEGV.
Guard every use of the shared Display with a threading.Lock so a query
can never overlap a close or another query.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent fc3f521 commit 9dd9cb0
1 file changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 70 | | |
70 | | - | |
71 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
72 | 79 | | |
73 | | - | |
| 80 | + | |
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
| |||
0 commit comments