aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-01-29 22:59:15 +0100
committerRobin Jarry <robin@jarry.cc>2024-01-31 16:08:55 +0100
commitf16b33f752bbc3086d08ba8fde034de48ab1c6d6 (patch)
treed58fa27ddb7a79134f57829c78eba3689f934952
parentfd4dd42408856048dd71f83ae1f30e2ab84621da (diff)
downloadaerc-f16b33f752bbc3086d08ba8fde034de48ab1c6d6.tar.gz
compose: fix deadlock when editor errors after :reply -c
When the message viewer is open and running :reply -c, if the editor exits with an error (e.g. vim :cq), the compose tab is not closed and aerc does not register input anymore. This happens because the composer is closed twice. Once explicitly, and a second time by RemoveTab. This causes to open two viewers on the same message at the same time. Here is the deadlock stack trace: goroutine 149 [sync.Mutex.Lock]: runtime.gopark() runtime/proc.go:398 ... sync.(*Mutex).Lock(...) sync/mutex.go:90 git.sr.ht/~rjarry/aerc/app.(*Composer).Show() git.sr.ht/~rjarry/aerc/app/compose.go:793 git.sr.ht/~rjarry/aerc/lib/ui.(*Tabs).selectPriv() git.sr.ht/~rjarry/aerc/lib/ui/tab.go:171 git.sr.ht/~rjarry/aerc/lib/ui.(*Tabs).Add() git.sr.ht/~rjarry/aerc/lib/ui/tab.go:75 git.sr.ht/~rjarry/aerc/app.(*Aerc).NewTab() git.sr.ht/~rjarry/aerc/app/aerc.go:481 git.sr.ht/~rjarry/aerc/app.NewTab(...) git.sr.ht/~rjarry/aerc/app/app.go:60 git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute.func1() git.sr.ht/~rjarry/aerc/commands/account/view.go:71 git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView.func1() git.sr.ht/~rjarry/aerc/lib/messageview.go:79 git.sr.ht/~rjarry/aerc/lib.NewMessageStoreView() git.sr.ht/~rjarry/aerc/lib/messageview.go:123 git.sr.ht/~rjarry/aerc/commands/account.ViewMessage.Execute() git.sr.ht/~rjarry/aerc/commands/account/view.go:52 git.sr.ht/~rjarry/aerc/commands/msg.reply.Execute.func1.1() git.sr.ht/~rjarry/aerc/commands/msg/reply.go:191 git.sr.ht/~rjarry/aerc/app.(*Composer).Close() git.sr.ht/~rjarry/aerc/app/compose.go:714 git.sr.ht/~rjarry/aerc/app.(*Composer).termClosed() git.sr.ht/~rjarry/aerc/app/compose.go:1189 git.sr.ht/~rjarry/aerc/app.(*Terminal).closeErr() git.sr.ht/~rjarry/aerc/app/terminal.go:69 git.sr.ht/~rjarry/aerc/app.(*Terminal).Close(...) git.sr.ht/~rjarry/aerc/app/terminal.go:46 git.sr.ht/~rjarry/aerc/app.(*Terminal).HandleEvent() git.sr.ht/~rjarry/aerc/app/terminal.go:174 git.sr.ht/~rockorager/tcell-term.(*VT).Start.func1() git.sr.ht/~rockorager/tcell-term@v0.10.0/vt.go:175 created by git.sr.ht/~rockorager/tcell-term.(*VT).Start in goroutine 1 git.sr.ht/~rockorager/tcell-term@v0.10.0/vt.go:165 +0x38d Fixes: https://todo.sr.ht/~rjarry/aerc/216 Reported-by: Karel Balej <balejk@matfyz.cz> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Karel Balej <balejk@matfyz.cz>
-rw-r--r--app/compose.go2
1 files changed, 0 insertions, 2 deletions
diff --git a/app/compose.go b/app/compose.go
index 4f369f38..754dc590 100644
--- a/app/compose.go
+++ b/app/compose.go
@@ -1186,7 +1186,6 @@ func (c *Composer) termClosed(err error) {
}
if editor.cmd.ProcessState.ExitCode() > 0 {
- c.Close()
RemoveTab(c, true)
PushError("Editor exited with error. Compose aborted!")
return
@@ -1199,7 +1198,6 @@ func (c *Composer) termClosed(err error) {
PushError(err.Error())
err := c.showTerminal()
if err != nil {
- c.Close()
RemoveTab(c, true)
PushError(err.Error())
}