From e40f5c5923d72b42d7b1c617a6e459569d584e8c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 21 Sep 2020 22:33:43 +0200 Subject: Fix crashes when static linking due to tricky lifetime management of ASDCP::DefaultSMPTEDict(). --- src/util.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/util.cc') diff --git a/src/util.cc b/src/util.cc index c7d090ea..009d5bae 100644 --- a/src/util.cc +++ b/src/util.cc @@ -76,6 +76,13 @@ using boost::function; using boost::algorithm::trim; using namespace dcp; + +/* Some ASDCP objects store this as a *&, for reasons which are not + * at all clear, so we have to keep this around forever. + */ +ASDCP::Dictionary const* dcp::asdcp_smpte_dict = 0; + + /** Create a UUID. * @return UUID. */ @@ -164,7 +171,7 @@ dcp::empty_or_white_space (string s) return true; } -/** Set up various bits that the library needs. Should be called one +/** Set up various bits that the library needs. Should be called once * by client applications. */ void @@ -189,6 +196,8 @@ dcp::init () } OpenSSL_add_all_algorithms(); + + asdcp_smpte_dict = &ASDCP::DefaultSMPTEDict(); } /** Decode a base64 string. The base64 decode routine in KM_util.cpp -- cgit v1.2.3