diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-05-23 14:52:08 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-05-23 14:52:08 +0100 |
| commit | 666d0b238f32c0383068d3d8f3936f46c4e67a14 (patch) | |
| tree | 1a1a39893432d78008f2311df03e40d4477cd715 /src/lib | |
| parent | 9c262e6cc1cc7d365dc9f5a66162158e1623e4f2 (diff) | |
Try to stop crashes when tests are torn down.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/dcp_encoder.cc | 8 | ||||
| -rw-r--r-- | src/lib/dcp_encoder.h | 1 | ||||
| -rw-r--r-- | src/lib/encoder.cc | 6 | ||||
| -rw-r--r-- | src/lib/encoder.h | 5 |
4 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/dcp_encoder.cc b/src/lib/dcp_encoder.cc index 522f02947..a37080405 100644 --- a/src/lib/dcp_encoder.cc +++ b/src/lib/dcp_encoder.cc @@ -68,6 +68,14 @@ DCPEncoder::DCPEncoder (shared_ptr<const Film> film, weak_ptr<Job> job) } } +DCPEncoder::~DCPEncoder () +{ + /* We must stop receiving more video data before we die */ + _player_video_connection.release (); + _player_audio_connection.release (); + _player_subtitle_connection.release (); +} + void DCPEncoder::go () { diff --git a/src/lib/dcp_encoder.h b/src/lib/dcp_encoder.h index 387921972..d35b06184 100644 --- a/src/lib/dcp_encoder.h +++ b/src/lib/dcp_encoder.h @@ -36,6 +36,7 @@ class DCPEncoder : public Encoder { public: DCPEncoder (boost::shared_ptr<const Film> film, boost::weak_ptr<Job> job); + ~DCPEncoder (); void go (); diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index 3af80efa5..16d992314 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -43,7 +43,7 @@ Encoder::Encoder (shared_ptr<const Film> film, weak_ptr<Job> job) , _job (job) , _player (new Player (film, film->playlist ())) { - _player->Video.connect (bind (&Encoder::video, this, _1, _2)); - _player->Audio.connect (bind (&Encoder::audio, this, _1, _2)); - _player->Subtitle.connect (bind (&Encoder::subtitle, this, _1, _2)); + _player_video_connection = _player->Video.connect (bind (&Encoder::video, this, _1, _2)); + _player_audio_connection = _player->Audio.connect (bind (&Encoder::audio, this, _1, _2)); + _player_subtitle_connection = _player->Subtitle.connect (bind (&Encoder::subtitle, this, _1, _2)); } diff --git a/src/lib/encoder.h b/src/lib/encoder.h index 79ad0ab44..645401952 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -24,6 +24,7 @@ #include "types.h" #include "player_subtitles.h" #include <boost/weak_ptr.hpp> +#include <boost/signals2.hpp> class Film; class Encoder; @@ -55,6 +56,10 @@ protected: boost::shared_ptr<const Film> _film; boost::weak_ptr<Job> _job; boost::shared_ptr<Player> _player; + + boost::signals2::scoped_connection _player_video_connection; + boost::signals2::scoped_connection _player_audio_connection; + boost::signals2::scoped_connection _player_subtitle_connection; }; #endif |
