diff options
author | Simon Woertz <simon@woertz.at> | 2021-11-07 16:22:12 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-11-08 16:34:03 -0800 |
commit | 1476f02f99e351f3171bf288eaecb47031dbdf4f (patch) | |
tree | aad5e20dba310c3f1b5e637d51a840f1b0165917 /Userland/Applications | |
parent | 1e48cd35a1229fe6cfbf9b24154f96f4d38fadf2 (diff) | |
download | serenity-1476f02f99e351f3171bf288eaecb47031dbdf4f.zip |
SoundPlayer: Fix stack-use-after-scope when playing file in loop mode
The path returned by GUI:FilePicker is stored on the stack when the
callback is executed. The player only stored a StringView to the path
however it should take ownership of the path instead since the path is
accessed even after the file menu open action has returned.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/SoundPlayer/Player.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/SoundPlayer/Player.h | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Applications/SoundPlayer/Player.cpp b/Userland/Applications/SoundPlayer/Player.cpp index 273e4c668d..70b6516994 100644 --- a/Userland/Applications/SoundPlayer/Player.cpp +++ b/Userland/Applications/SoundPlayer/Player.cpp @@ -38,7 +38,7 @@ Player::Player(Audio::ClientConnection& audio_client_connection) }; } -void Player::play_file_path(StringView path) +void Player::play_file_path(String const& path) { if (path.is_null()) return; diff --git a/Userland/Applications/SoundPlayer/Player.h b/Userland/Applications/SoundPlayer/Player.h index 74806231b3..1666032384 100644 --- a/Userland/Applications/SoundPlayer/Player.h +++ b/Userland/Applications/SoundPlayer/Player.h @@ -32,10 +32,10 @@ public: explicit Player(Audio::ClientConnection& audio_client_connection); virtual ~Player() { } - void play_file_path(StringView path); + void play_file_path(String const& path); Playlist& playlist() { return m_playlist; } - StringView loaded_filename() const { return m_loaded_filename; } + String const& loaded_filename() const { return m_loaded_filename; } PlayState play_state() const { return m_play_state; } void set_play_state(PlayState); @@ -84,6 +84,6 @@ private: Audio::ClientConnection& m_audio_client_connection; PlaybackManager m_playback_manager; - StringView m_loaded_filename; + String m_loaded_filename; double m_volume { 0 }; }; |