diff --git a/cmd/acme/internal/ui/text.go b/cmd/acme/internal/ui/text.go index 64fcc9a..1260eff 100644 --- a/cmd/acme/internal/ui/text.go +++ b/cmd/acme/internal/ui/text.go @@ -473,17 +473,23 @@ func Textselect(t *wind.Text) { // Do just the receive, dropping biglock // to let other goroutines proceed. // Note that *Mouse is Mousectl.Mouse. + // We also need to release the window lock, or else other code + // will deadlock with us by acquiring the big lock and _then_ acquiring + // the window lock + o := t.W.Owner + wind.Winunlock(t.W) BigUnlock() for Mouse.Buttons == b { *Mouse = <-Mousectl.C } BigLock() + wind.Winlock(t.W, o) clicktext = nil } } -var BigLock = func(){} -var BigUnlock = func(){} +var BigLock = func() {} +var BigUnlock = func() {} /* * Release the button in less than DELAY ms and it's considered a null selection diff --git a/cmd/acme/xfid.go b/cmd/acme/xfid.go index 892944a..9e5d6b3 100644 --- a/cmd/acme/xfid.go +++ b/cmd/acme/xfid.go @@ -846,9 +846,12 @@ func xfideventwrite(x *Xfid, w *wind.Window) { goto Rescue } + o := w.Owner + wind.Winunlock(w) bigUnlock() wind.TheRow.Lk.Lock() // just like mousethread bigLock() + wind.Winlock(w, o) switch c { case 'x', 'X':