-
-
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
Remove from disk: add to deck track menu, fix undeleted message #4560
Conversation
d78d78f
to
143c408
Compare
src/widget/wtrackmenu.cpp
Outdated
// Eject track from deck | ||
ControlProxy* ejectTrackProxy = new ControlProxy( | ||
m_deckGroup, "eject", this); | ||
ejectTrackProxy->set(1.0); |
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.
I'm not sure this is the best way to do it, but the first and simplest that came to mind.
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.
Do we need to check if it's the deleted track that's loaded?
The progress dialog is modal so manual unloading is not possible in he GUI, but with keyboards and controllers.
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.
Deleting an MP3 file while the audio stream is decoded might crash Mixxx: https://bugs.launchpad.net/mixxx/+bug/1452005
This happens because libmad/SoundSourceMP3 uses memory mapped files. You are not able to detect how many decoders are active. Checking if a track is loaded on a deck is not sufficient.
Better drop libmad/SoundSourceMP3 and use something more robust.
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.
This might also happen with the existing delete & purge action, right? Like when the Analysis feature is busy.
How do you propose to proceed?
143c408
to
6d65df6
Compare
I added another check and removed the redundant feature test. |
On second thought we should not enable the option to delete the file of a track that is loaded on a deck. This option should never be enabled if m_pTrack is set. |
I won't fight for this option, though I want to understand the reasons. |
It is counterintuitive to delete the file of a track while it is still loaded. Even if it doesn't crash Mixxx. |
I disagree to be honest. Its counterintuitive if I want to delete a track but can't for no apparent reason. Maybe I just listened to the track and decided that it doesn't belong into my library, so I want to delete it but can't because its still loaded in a deck. |
If we can't delete a track while its loaded for technical reason, I'd make that transparent so the user is confused (display the option, but grey it out and explain in a tooltip or something). |
We can simply
|
f86eb0f
to
6a9aeda
Compare
@@ -1761,6 +1778,17 @@ void WTrackMenu::slotRemoveFromDisk() { | |||
} | |||
} | |||
|
|||
// If the operation was initiated from a deck's track menu |
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.
This code drags dependencies into WTrackMenu that don't belong here. Another example of the spaghetti control flow in Mixxx, unmaintainable.
Is this side-effect even synchronous? Can we guarantee that the track is ejected immediately? Probably not, because decoding is done concurrently in a separate thread -> CachingReaderWorker.
I suppose this doesn't work as intended.
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.
This is only supposed to have a clean UX: it would be confusing if the deleted track was still loaded and could still be played.
Please clarify your technical concerns (for example the libmad issue) and give an estimation if this can be solved at all (by me, with guidance, of course). Because, if there are issues to be expected they apply to the delete and purge action in general, not just to the deck option, since we're not checking if a track queued for deletion is analyzed or loaded anywhere. If there are serious concerns it'd be sad they pop up just now because we'd then have wasted quite some time implementing the feature in the first place :\ (what I've learned along the way would be persist, but still..)
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.
I can't imagine an easy fix considering the current state of the code base. Merging the code for deleting files directly from within Mixxx without any chance to detect if those files are still accessed by Mixxx probably was a mistake. We didn't consider all the consequences.
I don't veto against merging this PR, but on the other hand I won't merge it myself. Someone else may decide.
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, that's unfortunate.
I'm puzzled why you approve the changes even though you have serious technical objections.
I still don't overlook the potential consequences:
The worst case would be Mixxx crashing when deleting mp3 files due to the libmad / SoundSourceMP3 / mmap issue, right? In that case I wouldn't mind removing the entire feature.
Besides that, what could happen that harms the database or puts Mixxx into an inconsistent state?
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.
I could only delete the entire review or keep the rejection. Both are not an option for me. "Disagree and merge" or "Disagree and let others merge" (for a second opinion).
I don't really care enough and I also don't have a better proposal. The code is just ugly with the entanglement of the control proxies for triggering a side-effect in another component directly. It works somehow, but probably not always.
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.
Okay, then thanks for your review!
I'll leave to others to judge the remove feature.
6a9aeda
to
0bf2ce3
Compare
(I squashed the small fixup commits) |
Rebased after #4639 has been merged. |
0bf2ce3
to
b9d5a4c
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.
Thank you. I have some final comment:
QString("<br><br><b>") + | ||
tr("This can not be undone!") + QString("</b>"); | ||
} else { | ||
delWarningText = |
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.
On Linux you can delete the file while playing.
It is actually removed after the last reference to the file has been closed.
On Windows the file is locked until all file handles are closed.
I am not sure how it relates to caching. The file is kept in cache after rejecting.
We need to check if the lock is released than.
LGTM, Thank you. Sorry for the delay, this one has slipped through. |
Never mind, this one wasn't urgent. |
Yes, at least on my Win 10 Virtual Machine it works without any issues. |
I was missing Remove From Disk in the deck menu when I was too lazy to look for the track in the library.
Here it is.