Drag-n-drop loading improvements #106
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since drag-n-drop loading seems to still be in a fragile state I made some new improvements for file loading.
First, the drag-n-drop loading logic is taken out of the
handleMsg
switch case and moved into its own functionhandleFileDrop
.The function is then expanded with extra safeties to try and prevent crashes due to a race condition, or crashes due to really long paths to the files.
Btw, MP3 is more prone to crashing when randomly dragging and dropping files than OGG is. This PR makes MP3 loading a lot less prone to crashing the app, but this doesn't completely 100% resolve weird behavior with specifically loading MP3 this way. I haven't looked into the LoadMp3 code yet, so I'll check it later to see if there's something we can be doing better.