Skip to content

Conversation

sukibaby
Copy link
Collaborator

@sukibaby sukibaby commented Jul 10, 2025

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 function handleFileDrop.

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.

@sukibaby sukibaby closed this Jul 10, 2025
@sukibaby sukibaby reopened this Jul 10, 2025
The ultimate goal of this commit was to move the handling of loading files via drag-and-drop out of the handleMsg switch case and into its own function.

Once it was in its own function I made the function more robust. I also noticed a frequent crash was due to a race condition between the destruction of WideString and the DragFinish call. Scoping the loop that contains WideString guarantees this race condition can't occur.

Resolve a crash caused by really long path names

https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation

Update System.cpp

Update System.cpp
@uvcat7
Copy link
Owner

uvcat7 commented Jul 10, 2025

I think my commit to #108 fixes this. Can you test/confirm?

@sukibaby
Copy link
Collaborator Author

I think my commit to #108 fixes this. Can you test/confirm?

It does seem to, so I'll close this and you can merge 108 🙏

@sukibaby sukibaby closed this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants