projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2a57440
)
typeid() doesn't seem to downcast, so just check types in the take_settings_from...
author
Carl Hetherington
<cth@carlh.net>
Thu, 8 Feb 2018 20:57:03 +0000
(20:57 +0000)
committer
Carl Hetherington
<cth@carlh.net>
Thu, 8 Feb 2018 20:57:03 +0000
(20:57 +0000)
ChangeLog
patch
|
blob
|
history
src/lib/content.cc
patch
|
blob
|
history
src/lib/dcp_content.cc
patch
|
blob
|
history
src/lib/ffmpeg_content.cc
patch
|
blob
|
history
src/lib/film.cc
patch
|
blob
|
history
diff --git
a/ChangeLog
b/ChangeLog
index 91263bed6d62d26dad20640d50a744ee1efd8e37..cd3e90e1dededa22bf10cb0742496f54f8252983 100644
(file)
--- a/
ChangeLog
+++ b/
ChangeLog
@@
-1,3
+1,8
@@
+2018-02-08 Carl Hetherington <cth@carlh.net>
+
+ * Fix crash on adding content to a project created from a template
+ in some cases (#1192).
+
2018-02-07 Carl Hetherington <cth@carlh.net>
* Version 2.11.50 released.
2018-02-07 Carl Hetherington <cth@carlh.net>
* Version 2.11.50 released.
diff --git
a/src/lib/content.cc
b/src/lib/content.cc
index 7b1e630a6610b92db3ec373b67f15d106db070a6..f2380653f661d54131e50194f42522742f07a562 100644
(file)
--- 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)
{
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 a6424874adb6978d488693c542fb4122d0206da6..ad489917d65c41e6a328ec6b0dd0f37b046085e9 100644
(file)
--- 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);
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;
_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 64da0b1af0b71d2f8e8d6909655a8ed08a896e41..06ed5a8014f81db7b29b3efe1bf73c1017a789b1 100644
(file)
--- 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)
{
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);
shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (c);
+ if (!fc) {
+ return;
+ }
+
+ Content::take_settings_from (c);
_filters = fc->_filters;
}
_filters = fc->_filters;
}
diff --git
a/src/lib/film.cc
b/src/lib/film.cc
index 2b045f5c4c2fcef84503e4dc32874501deb94420..db1cb39aaad5b90075b6aaaca5eb67c118bf852f 100644
(file)
--- 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 (_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);
}
}
}
}