mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-04 08:37:30 +00:00
plans: chat console race: crash window
This commit is contained in:
1 parent
d115d9c6a1
commit
b67d102c1e
1 file changed
+1
-1
@@ -7,7 +7,7 @@ Issue #7755.
|
||||
`ChatModel.addTerminalItem(item, maxItems)` reads `terminalItems.value` for the size check, twice on the `subList` line (the list and its size), and again for the append, without a lock. While no chat console is open, it runs on the caller's thread: `sendCmd` on the IO dispatcher, the receiver loop, and the migration receivers, several at once. (With a console open, writes are posted to the main thread.)
|
||||
|
||||
Two concurrent calls can:
|
||||
- crash with `IndexOutOfBoundsException: toIndex = 201` in `subList`: another thread appended between the two reads of `terminalItems.value` in the `subList` line (that thread had skipped the trim on an out-of-date size check, so the list went past the cap);
|
||||
- crash with `IndexOutOfBoundsException: toIndex = 201` in `subList`: another thread appended between the two reads of `terminalItems.value` in the `subList` line;
|
||||
- lose a row: both read the same list and the second write replaces the first;
|
||||
- keep the list above the cap.
|
||||
|
||||
|
||||
Reference in new issue
Block a user