Skip to content
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

Crash if clicking play audio maniacally fast (or the computer is too slow) #1423

Closed
shenlebantongying opened this issue Mar 20, 2024 · 0 comments

Comments

@shenlebantongying
Copy link
Collaborator

To reproduce easier, try to add a sanitizer to slow down.

add_compile_options(-fno-omit-frame-pointer -fsanitize=address)
add_link_options(-fno-omit-frame-pointer -fsanitize=address)

Add a sound folder with a single sound -> https://upload.wikimedia.org/wikipedia/commons/5/52/En-us-hello.ogg

The problem is the operator = of std::shared_ptr will destroy the previous owned data first. https://en.cppreference.com/w/cpp/memory/shared_ptr/operator%3D

The emit cancelPlaying( false ); doesn't imply the thread will shut down immediately.

If the computer is slow enough, or someone clicks too fast, thread = std::make_shared< DecoderThread >( audioData, this ); will try to delete a running QThread and give this message QThread: Destroyed while thread is still running

emit cancelPlaying( false );
QByteArray audioData( ptr, size );
thread = std::make_shared< DecoderThread >( audioData, this );

Screen.Recording.2024-03-19.at.8.35.45.PM.mov
@shenlebantongying shenlebantongying changed the title Crash if clicking play audio insanely fast (or the computer is too slow) Crash if clicking play audio maniacally fast (or the computer is too slow) Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant