diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-02-08 20:57:03 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-02-08 20:57:03 +0000 |
| commit | d9825793692a41374b184f423994667b663d8526 (patch) | |
| tree | d1a4a1fd157ea55bbcbf47a6fa55b6c1679daf04 /src | |
| parent | 2a574403f57ff980ca5e627d389f30e91bff02c7 (diff) | |
typeid() doesn't seem to downcast, so just check types in the take_settings_from methods (#1192).
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/content.cc | 1 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 7 | ||||
| -rw-r--r-- | src/lib/film.cc | 4 |
4 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index 7b1e630a6..f2380653f 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -420,6 +420,7 @@ Content::add_properties (list<UserProperty>& p) const } } +/** Take settings from the given content if it is of the correct type */ void Content::take_settings_from (shared_ptr<const Content> c) { diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index a6424874a..ad489917d 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -543,7 +543,9 @@ void DCPContent::take_settings_from (shared_ptr<const Content> c) { shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (c); - DCPOMATIC_ASSERT (dc); + if (!dc) { + return; + } _reference_video = dc->_reference_video; _reference_audio = dc->_reference_audio; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 64da0b1af..06ed5a801 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -606,8 +606,11 @@ FFmpegContent::ffmpeg_audio_streams () const void FFmpegContent::take_settings_from (shared_ptr<const Content> c) { - Content::take_settings_from (c); - shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (c); + if (!fc) { + return; + } + + Content::take_settings_from (c); _filters = fc->_filters; } diff --git a/src/lib/film.cc b/src/lib/film.cc index 2b045f5c4..db1cb39aa 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1086,9 +1086,7 @@ Film::add_content (shared_ptr<Content> c) if (_template_film) { /* Take settings from the first piece of content of c's type in _template */ BOOST_FOREACH (shared_ptr<Content> i, _template_film->content()) { - if (typeid(i.get()) == typeid(c.get())) { - c->take_settings_from (i); - } + c->take_settings_from (i); } } |
