aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-11-01 14:08:58 -0500
committerRobin Jarry <robin@jarry.cc>2022-11-06 23:18:25 +0100
commit5540e3efb83e5bc50dc4600d5e66c16fca25451a (patch)
tree8e6ed9dd92c629346e0bb0e1edd5ce90cf1fce5c
parent1f682fc610de1beb57c68b92fe98bf057483773c (diff)
downloadaerc-5540e3efb83e5bc50dc4600d5e66c16fca25451a.tar.gz
split: close current split after replacing with new
Close the current split view after replacing it with a new view. Previously we closed it before replacing it with the new split view which could create a race condition when attempting the replace. Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--widgets/account.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/widgets/account.go b/widgets/account.go
index f1360b8f..5bbe97e1 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -517,9 +517,6 @@ func (acct *AccountView) UpdateSplitView() {
acct.splitDebounce.Stop()
}
fn := func() {
- if acct.split != nil {
- acct.split.Close()
- }
msg, err := acct.SelectedMessage()
if err != nil {
return
@@ -533,6 +530,9 @@ func (acct *AccountView) UpdateSplitView() {
orig := acct.split
acct.split = NewMessageViewer(acct, acct.conf, view)
acct.grid.ReplaceChild(orig, acct.split)
+ if orig != nil {
+ orig.Close()
+ }
})
acct.splitMsg = msg
ui.Invalidate()