From 653a2658d433ff6316f9c42ae8db372db8263fb5 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Tue, 28 May 2024 07:50:36 -0700 Subject: [PATCH] Fix #391: ensure artist radio button updates properly when reusing artist page --- ui/browsing/artistpage.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/browsing/artistpage.go b/ui/browsing/artistpage.go index 741ec8a..180d5a1 100644 --- a/ui/browsing/artistpage.go +++ b/ui/browsing/artistpage.go @@ -128,6 +128,7 @@ func (a *ArtistPage) Save() SavedPage { tl.Clear() a.pool.Release(util.WidgetTypeTracklist, tl) } + a.header.artistPage = nil a.pool.Release(util.WidgetTypeArtistPageHeader, a.header) if a.albumGrid != nil { a.albumGrid.Clear() @@ -320,7 +321,11 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader { a.playBtn = widget.NewButtonWithIcon("Play Discography", theme.MediaPlayIcon(), func() { go a.artistPage.contr.PlayArtistDiscography(a.artistID, false /*shuffle*/) }) - a.playRadioBtn = widget.NewButtonWithIcon("Play Artist Radio", myTheme.ShuffleIcon, a.artistPage.playArtistRadio) + a.playRadioBtn = widget.NewButtonWithIcon("Play Artist Radio", myTheme.ShuffleIcon, func() { + // must not pass playArtistRadio func directly to NewButton + // because the artistPage bound to this header can change when reused + a.artistPage.playArtistRadio() + }) var pop *widget.PopUpMenu a.menuBtn = widget.NewButtonWithIcon("", theme.MoreHorizontalIcon(), nil)