@@ -339,7 +339,8 @@ void MainViewController::onSpotifyTrackListRetryButtonClicked() {
339339}
340340
341341void MainViewController::setFilter (const CustomSongFilter& customSongFilter) {
342- customSongFilter_ = std::make_unique<CustomSongFilter>(customSongFilter);
342+ customSongFilter_ = customSongFilter;
343+ customSongFilter_.includeDownloadedSongs_ = isShowingDownloadedMaps_;
343344 if (selectedTrack_) {
344345 doSongSearch (*selectedTrack_);
345346 }
@@ -353,7 +354,7 @@ void MainViewController::ctor() {
353354 isLoadingMoreSpotifyPlaylists_ = false ;
354355 allTracksLoaded_ = false ;
355356 allPlaylistsLoaded_ = false ;
356- customSongFilter_ = std::make_unique< CustomSongFilter> ();
357+ customSongFilter_ = CustomSongFilter ();
357358 isShowingAllTracksByArtist_ = false ;
358359 isShowingDownloadedMaps_ = true ;
359360 currentSongFilter_ = SpotifySearch::Filter::DEFAULT_SONG_FILTER_FUNCTION;
@@ -650,11 +651,12 @@ void MainViewController::doSongSearch(const spotify::Track& track) {
650651 searchResultsListViewErrorContainer_->get_gameObject ()->set_active (false );
651652
652653 isSearchInProgress_ = true ;
653- std::thread ([this , track]() {
654+ const CustomSongFilter customSongFilter = customSongFilter_;
655+ std::thread ([this , track, customSongFilter]() {
654656 SongDetailsCache::SongDetails* songDetails = SongDetailsCache::SongDetails::Init ().get ();
655- std::vector<const SongDetailsCache::Song*> songs = songDetails->FindSongs ([this ](const SongDetailsCache::SongDifficulty& songDifficulty) {
657+ std::vector<const SongDetailsCache::Song*> songs = songDetails->FindSongs ([customSongFilter ](const SongDetailsCache::SongDifficulty& songDifficulty) {
656658 // Difficulty
657- const std::vector<SongDetailsCache::MapDifficulty>& filterMapDifficulties = customSongFilter_-> difficulties_ ;
659+ const std::vector<SongDetailsCache::MapDifficulty>& filterMapDifficulties = customSongFilter. difficulties_ ;
658660 if (!filterMapDifficulties.empty ()) {
659661 const SongDetailsCache::MapDifficulty mapDifficulty = songDifficulty.difficulty ;
660662 if (!std::ranges::contains (filterMapDifficulties, mapDifficulty)) {
@@ -663,7 +665,7 @@ void MainViewController::doSongSearch(const spotify::Track& track) {
663665 }
664666
665667 // Show downloaded songs
666- if (!customSongFilter_-> includeDownloadedSongs_ ) {
668+ if (!customSongFilter. includeDownloadedSongs_ ) {
667669 if (SongCore::API::Loading::GetLevelByHash (songDifficulty.song ().hash ())) {
668670 return false ;
669671 }
@@ -1013,9 +1015,8 @@ void MainViewController::onHideDownloadedMapsButtonClicked() {
10131015 controller->HideHintInstant (hoverHintComponent);
10141016 controller->SetupAndShowHintPanel (hoverHintComponent);
10151017
1016- auto csf = std::move (customSongFilter_);
1017- csf->includeDownloadedSongs_ = isShowingDownloadedMaps_;
1018- setFilter (*csf);
1018+ customSongFilter_.includeDownloadedSongs_ = isShowingDownloadedMaps_;
1019+ setFilter (customSongFilter_);
10191020}
10201021
10211022void MainViewController::onDownloadButtonClicked () {
0 commit comments