fix memory leak in page history

This commit is contained in:
Drew Weymouth
2023-01-09 16:47:35 -08:00
parent bec7608ec4
commit 1d27b70a6f
+4
View File
@@ -100,6 +100,10 @@ func (b *BrowsingPane) onSongChange(song *subsonic.Child) {
}
func (b *BrowsingPane) addPageToHistory(p Page) {
// allow garbage collection of pages that will be removed from the history
for i := b.historyIdx; i < len(b.history); i++ {
b.history[i] = nil
}
b.history = b.history[:b.historyIdx]
b.history = append(b.history, p)
b.historyIdx++