From 5540e3efb83e5bc50dc4600d5e66c16fca25451a Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 1 Nov 2022 14:08:58 -0500 Subject: 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 Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- widgets/account.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'widgets/account.go') 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() -- cgit