Skip to content

(fix) prevent deletion of current History playlist after purging tracks - #15991

Merged
ywwg merged 2 commits into
mixxxdj:2.5from
ronso0:removeFromDisk-dont-delete-curr-history-playlist
Feb 26, 2026
Merged

(fix) prevent deletion of current History playlist after purging tracks#15991
ywwg merged 2 commits into
mixxxdj:2.5from
ronso0:removeFromDisk-dont-delete-curr-history-playlist

Conversation

@ronso0

@ronso0 ronso0 commented Feb 16, 2026

Copy link
Copy Markdown
Member

Some time I played a practice session, with lots of cleanup and prep work.
Next time I started Mixxx that session was gone 🤔

Turns out this happens when the first track in a session is removed from disk (-> purged from library).

Fix: add a safeguard to keep the current history if the playlist cleanup method is called after purge.
Usual cleanup during shutdown and startup is not affected.

@ronso0 ronso0 added this to the 2.6.0 milestone Feb 16, 2026
@acolombier

Copy link
Copy Markdown
Member

Some time I played a practice session, with lots of cleanup and prep work.
Next time I started Mixxx that session was gone 🤔

This is still the thing that frustrates me the most - another instance of looking all the cleanup and prep work is a crash before the end of the session... Would be nice to look as #13001 at some point!

// Else the following session log is lost -- or rather not recorded in the
// first place since the id passed to appendTrackToPlaylist() does not exist
// anymore.
// skipCurrHistory prevents that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case where we would want to call this method with skipCurrHistory = false? To me, it sounds like, as long as m_currentHistoryPlaylist != kInvalidPlaylistId, we wouldn't never want to delete it as itwould prevent further recording. I am missing something?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also run on shutdown in order to remove history with less than N tracks. And m_currentHistoryPlaylist is still valid then.

@ywwg ywwg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it also be possible to assert / throw an error if a track is attempted to be added to the setlog and it fails? I'm not sure what to do in a release build in that case, because crashing probably wouldn't be nice.

Comment thread src/library/dao/playlistdao.cpp Outdated

if (idStringList.isEmpty()) {
return false;
} else {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for else after return

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm if you can also address this

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@ronso0

ronso0 commented Feb 18, 2026

Copy link
Copy Markdown
Member Author

would it also be possible to assert / throw an error if a track is attempted to be added to the setlog and it fails? I'm not sure what to do in a release build in that case, because crashing probably wouldn't be nice.

Sure we can do that. We could create the playlist, but IIRC it requires some back'n'forth between SetlogFeature and PlaylistDAO. Will take a look.

Though, this should be safe now. We have the guard in the DAO delete method and, before this is called, we also already prevent manual deletion of the current history in SetlogFeature.

@ywwg

ywwg commented Feb 18, 2026

Copy link
Copy Markdown
Member

Though, this should be safe now.

agree, but at the very least I'd like to add a debug assert if an insert into a playlist fails

@ronso0

ronso0 commented Feb 18, 2026

Copy link
Copy Markdown
Member Author

I added bool playlistExists(id) and used it in the append method.

@ronso0
ronso0 force-pushed the removeFromDisk-dont-delete-curr-history-playlist branch from 2262ea9 to cb30f0c Compare February 20, 2026 22:19
@ronso0

ronso0 commented Feb 23, 2026

Copy link
Copy Markdown
Member Author

Ready for merge?

@acolombier
acolombier requested a review from ywwg February 23, 2026 16:16
@ronso0

ronso0 commented Feb 25, 2026

Copy link
Copy Markdown
Member Author

Oh, I targeted 2.6 only because I assumed there wouldn't be a 2.5.5 release anymore.
But turns out we'll have that.
Will rebase.

@ronso0

ronso0 commented Feb 25, 2026

Copy link
Copy Markdown
Member Author

Oh, I already worked on top of 2.5 locally

@ronso0

ronso0 commented Feb 25, 2026

Copy link
Copy Markdown
Member Author

hmm why did I see "2.6" up there 🤔
sorry for the noise..

@ronso0 ronso0 modified the milestones: 2.6.0, 2.5.5 Feb 25, 2026
@ywwg
ywwg merged commit 3527b38 into mixxxdj:2.5 Feb 26, 2026
13 checks passed
@ronso0
ronso0 deleted the removeFromDisk-dont-delete-curr-history-playlist branch February 26, 2026 14:14
@github-project-automation github-project-automation Bot moved this from In progress to Done in Releases Mar 5, 2026
@github-project-automation github-project-automation Bot moved this to In progress in Releases Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants