summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-26 20:04:33 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-26 20:04:33 +0200
commit8987f133295e352c44e05ef338eacc801c61a629 (patch)
tree6325c00b2c1097bb483568ddad8b545e0e40f717 /src/wx
parentb6fb82e5df5551497b823f20a75c7ff94ffd1b3e (diff)
Fix race between the Butler thread starting and audio (perhaps) being disabled.
This could cause Butler::audio to be called with _audio_channels = 0 and _disable_audio = false, causing an exception in AudioBuffers when remap() tried to make an AudioBuffers object with a channel count of 0.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/film_viewer.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 510269793..b5b2ca972 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -228,13 +228,10 @@ FilmViewer::recreate_butler ()
VideoRange::FULL,
j2k_gl_optimised ? Image::Alignment::COMPACT : Image::Alignment::PADDED,
true,
- j2k_gl_optimised
+ j2k_gl_optimised,
+ (Config::instance()->sound() && _audio.isStreamOpen()) ? Butler::Audio::ENABLED : Butler::Audio::DISABLED
);
- if (!Config::instance()->sound() && !_audio.isStreamOpen()) {
- _butler->disable_audio ();
- }
-
_closed_captions_dialog->set_butler (_butler);
resume ();