Skip to content

Commit

Permalink
Fix a race condition with error windows
Browse files Browse the repository at this point in the history
Fixes #57: we lookup a window in `edwood/util.go:66`. It's happy to
find a window from `g.row` while `g.row` is locked and that window
struct can be invalid at the time during a `del()` action. So lock the
row/column struct while obtaining the window object.
  • Loading branch information
rjkroege committed Jan 15, 2022
1 parent 6d0d50f commit d0f2601
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xfid.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ func xfidwrite(x *Xfid) {
//x.fcall.Data[x.fcall.Count] = 0; // null-terminate. unneeded
switch qid {
case Qcons:
global.row.lk.Lock()
w = errorwin(x.f.mntdir, 'X')
global.row.lk.Unlock()
updateText(&w.body)

case Qlabel:
Expand Down

0 comments on commit d0f2601

Please sign in to comment.