Fix unsafe unlocked leak of reference.
authorCarl Hetherington <cth@carlh.net>
Tue, 2 Jun 2015 14:22:24 +0000 (15:22 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 2 Jun 2015 14:22:24 +0000 (15:22 +0100)
src/lib/audio_stream.h
src/lib/ffmpeg_content.cc
src/lib/single_stream_audio_content.cc

index b3b203b39aa667b46ad747a39a4d2c79dd9bcefa..ea6c54eadabb75188cc576d71d92e76698043bd7 100644 (file)
@@ -34,16 +34,11 @@ public:
        void set_mapping (AudioMapping mapping);
        void set_frame_rate (int frame_rate);
 
-       AudioMapping const & mapping () const {
+       AudioMapping mapping () const {
                boost::mutex::scoped_lock lm (_mutex);
                return _mapping;
        }
 
-       AudioMapping & mapping () {
-               boost::mutex::scoped_lock lm (_mutex);
-               return _mapping;
-       }
-       
        int frame_rate () const {
                boost::mutex::scoped_lock lm (_mutex);
                return _frame_rate;
index fa2671b3697c2663060d7403863421bf72b1f04c..eab11023618e182b20d71a9357ff9580fe8886f0 100644 (file)
@@ -173,7 +173,9 @@ FFmpegContent::examine (shared_ptr<Job> job)
                _audio_streams = examiner->audio_streams ();
 
                if (!_audio_streams.empty ()) {
-                       _audio_streams.front()->mapping().make_default ();
+                       AudioMapping m = _audio_streams.front()->mapping ();
+                       m.make_default ();
+                       _audio_streams.front()->set_mapping (m);
                }
 
                _first_video = examiner->first_video ();
index 3389c0557f6a233a0e9ec1ef8f729a8e384471e8..a38ef0e1e8ed2a6e2c8ac6b23fa04ec6ee3fccac 100644 (file)
@@ -63,7 +63,9 @@ SingleStreamAudioContent::take_from_audio_examiner (shared_ptr<AudioExaminer> ex
        {
                boost::mutex::scoped_lock lm (_mutex);
                _audio_stream.reset (new AudioStream (examiner->audio_frame_rate(), examiner->audio_channels ()));
-               _audio_stream->mapping().make_default ();
+               AudioMapping m = _audio_stream->mapping ();
+               m.make_default ();
+               _audio_stream->set_mapping (m);
        }
 
        signal_changed (AudioContentProperty::AUDIO_STREAMS);