Fix highlighting crash when line index is outdated - #4146
Conversation
|
I just got this as well and lost (unsaved) data (although nothing too important) because of this. Maybe we should merge this since it is a crash, not to mention plugins can call this directly with out of bound Loc and crash it as well. |
|
I saw this PR already, but had the same feeling as @omarelladen with...
...that it will cover/hide the real root cause of asynchronous access or insufficient access order. |
|
Just to make sure I am on the same page, correct me if I am wrong, the crash is in micro/internal/display/bufwindow.go Line 383 in 77de728 which is called from Line 504 in 22930a5
What is running asynchronously/concurrently when Otherwise, somehow |
A couple of things are running concurrently with it (e.g. syntax highlighter, background backups) but none of them are supposed to modify the buffer. It is only supposed to be modified by the main goroutine. |
A random crash happened to me:
Since I was using version 2.0.14-1+b6 from Debian, the problem is in this line:
micro/internal/buffer/line_array.go
Line 389 in 77de728
(check https://sources.debian.org/src/micro/2.0.14-1/internal/buffer/line_array.go#L394)
I could not reproduce the bug, but it seems to me that the highlighter was trying to access a line that was just deleted, using an outdated Y position of the window. So this proposed fix is simple, but the concurrent access problem can be deeper.