From: Carl Hetherington Date: Thu, 17 Sep 2020 12:00:21 +0000 (+0200) Subject: Prevent DCP::assets() from returning duplicates. X-Git-Tag: v1.8.0~306 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=40f6f7d9e8fe6107dff0e5e355b577a2b289e3fa;p=libdcp.git Prevent DCP::assets() from returning duplicates. --- diff --git a/src/dcp.cc b/src/dcp.cc index b7a0da8b..bf8366f3 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -507,12 +507,23 @@ DCP::assets (bool ignore_unresolved) const if (ignore_unresolved && !j->asset_ref().resolved()) { continue; } - shared_ptr o = j->asset_ref().asset (); - assets.push_back (o); - /* More Interop special-casing */ - shared_ptr sub = dynamic_pointer_cast (o); - if (sub) { - sub->add_font_assets (assets); + + string const id = j->asset_ref().id(); + bool already_got = false; + BOOST_FOREACH (shared_ptr k, assets) { + if (k->id() == id) { + already_got = true; + } + } + + if (!already_got) { + shared_ptr o = j->asset_ref().asset(); + assets.push_back (o); + /* More Interop special-casing */ + shared_ptr sub = dynamic_pointer_cast (o); + if (sub) { + sub->add_font_assets (assets); + } } } }