aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalanto <62221668+Salanto@users.noreply.github.com>2022-02-18 20:51:27 +0100
committerGitHub <noreply@github.com>2022-02-18 22:51:27 +0300
commitdd53b01ffde959e808e7974cdc302f12e0ba5820 (patch)
tree9c035ee6d6dea42917a0947f888d2d8643c1c86e
parente6f06d8959ff65be11b20dcba27977f8935bb044 (diff)
Address potential source of race confition inside the play function (#658)
Current working theory is that setting the future opens a brief interval where it deconstructs the old future and returning an invalid QFuture,, causing a segmentation fault.
-rw-r--r--src/courtroom.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 3fb691e9..34a596da 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -3873,17 +3873,16 @@ void Courtroom::handle_song(QStringList *p_contents)
}
}
- QFuture<QString> future = QtConcurrent::run(music_player, &AOMusicPlayer::play, f_song, channel,
- looping, effect_flags);
if (channel == 0) {
// Current song UI only displays the song playing, not other channels.
// Any other music playing is irrelevant.
if (music_player->music_watcher.isRunning()) {
music_player->music_watcher.cancel();
}
- music_player->music_watcher.setFuture(future);
ui_music_name->setText(tr("[LOADING] %1").arg(f_song_clear));
}
+ music_player->music_watcher.setFuture(QtConcurrent::run(music_player, &AOMusicPlayer::play, f_song, channel,
+ looping, effect_flags));
}
void Courtroom::update_ui_music_name()