-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(fix) Track menu: avoid crash and UX issues with track nullptr #13685
Conversation
does |
TrackDAO returns nullptr when it (actually GlobalTrackCacheResolver) encounters a duplicate. |
I updated the description with more findings wrt UX inconsistency. I'll make some small UX fixes soonish. |
be3ce61
to
7cbc4bd
Compare
Some fixes... If desired, I can move the DlgTagFetcher fix to a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you. What is your plan with the TODOs?
src/widget/wtrackmenu.cpp
Outdated
@@ -849,6 +849,7 @@ void WTrackMenu::updateMenus() { | |||
if (featureIsEnabled(Feature::LoadTo)) { | |||
int iNumDecks = static_cast<int>(m_pNumDecks.get()); | |||
m_pDeckMenu->clear(); | |||
// TODO Only enable for single track? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
src/widget/wtrackmenu.cpp
Outdated
@@ -964,6 +965,7 @@ void WTrackMenu::updateMenus() { | |||
bool anyBpmLocked; | |||
bool anyBpmNotLocked; | |||
std::tie(anyBpmLocked, anyBpmNotLocked) = getTrackBpmLockStates(); | |||
// TODO Disable menu if anyBpmLocked == anyBpmNotLocked ?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reflecting the state with the menu would be nice.
I can imagine a use case where you want clear all BPM values of not locked tracks. Therefor a feature might suit that is enabled when at least one track has no BPM locked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the TODO text is not clear. What I meant was: disable the menu if both are false which happens if getTrackBpmLockStates() found no valid track.
But actually, if users run into null tracks unnoticed, those tracks won't be processed and the log should contain a warning, which IMO is more helpful to discover null tracks than greying out the menu.
I'll remove the TODO
0edd51a
to
580a8fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thank you.
This is just a quick fix to avoid a crash when trying to open the track menu or Track Properties with Ctrl+P
when the selection contains a duplicate track. (a track that references the same file as another track)
Note: fixin the UX inconsistencies (see below) is a lot more work, probably requires some not so trivial refactoring.
No idea how I got that duplicate file, but it's awful show stopper.
The general question is how to provide helpful info to the user so they can resolve the situation themselves (without having to edit the database manually).
The menu and Track Properties can now be opened (Track Props is empty) but at least it doesn't crash anymore (in release builds / with DEBUG_ASSERTIONS_FATAL = OFF).
Note for testing:
In case you manage to create a duplicate track, you need to disable this DEBUG_ASSERT in TrackDAO inorder to proceed
mixxx/src/library/dao/trackdao.cpp
Line 1440 in f5890a8
FWIW I couldn't duplicate a track with DB Browser for SQlite, it prevents that:
Error changing data: UNIQUE constraint failed: track_locations.location
Uff, the UX when encountering such a duplicate is very inconsistent, and I think a 'normal' user (DEBUG_ASSERTIONS_FATAL = OFF) does not get enough information to resolve the situation:
and most (all?) actions workwas confused due to ¹disabled: Find On Web
works: Add to Auto DJ, Add to Playlist/Crate (though sidebar items are not set bold)
not working: BPM, Color, ...
Search Related:
WTrackTableView::loadSelectedTrackToGroup
aborts due to nullptr)¹
GlobalTrackCache/TrackDAO throw the warning for the newer track.No, it depends on which track has been cached first. So the dupe can be different in each session.