add_fonts_from_examiner() can be called multiple times with the same font
authorCarl Hetherington <cth@carlh.net>
Thu, 11 May 2023 11:48:58 +0000 (13:48 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 May 2023 20:11:06 +0000 (22:11 +0200)
in the case of closed captions with multiple tracks.  Don't reuse the
same font objects in this case, otherwise we will start with something
like font, disambiguate it to 0_font, then disambiguate _that_ to
0_0_font.

src/lib/dcp_content.cc

index cad775b24854b9c79aba7448570c11a70edd99ce..7d835e618f1ecdfe2185f57863fea40093d7144d 100644 (file)
@@ -831,8 +831,9 @@ add_fonts_from_examiner(shared_ptr<TextContent> text, vector<vector<shared_ptr<F
                         * by prepending the reel number.  We do the same disambiguation when emitting the
                         * subtitles in the DCP decoder.
                         */
-                       font->set_id(id_for_font_in_reel(font->id(), reel_number));
-                       text->add_font(font);
+                       auto font_copy = make_shared<dcpomatic::Font>(*font);
+                       font_copy->set_id(id_for_font_in_reel(font->id(), reel_number));
+                       text->add_font(font_copy);
                }
                ++reel_number;
        }