diff --git a/gnucash/gnucash-cli.cpp b/gnucash/gnucash-cli.cpp index e22479ffa9..d384675a94 100644 --- a/gnucash/gnucash-cli.cpp +++ b/gnucash/gnucash-cli.cpp @@ -131,7 +131,7 @@ Gnucash::GnucashCli::start ([[maybe_unused]] int argc, [[maybe_unused]] char **a { if (*m_quotes_cmd == "info") { - auto quotes = gnc_get_quotes_instance(); + GncQuotes quotes; if (quotes.cmd_result() == 0) { std::cout << bl::format (bl::translate ("Found Finance::Quote version {1}.")) % quotes.version() << "\n"; diff --git a/gnucash/gnucash-commands.cpp b/gnucash/gnucash-commands.cpp index eb1c7c2e2b..bb9d778dd5 100644 --- a/gnucash/gnucash-commands.cpp +++ b/gnucash/gnucash-commands.cpp @@ -82,7 +82,7 @@ scm_add_quotes(void *data, [[maybe_unused]] int argc, [[maybe_unused]] char **ar gnc_prefs_init (); qof_event_suspend(); - auto quotes = gnc_get_quotes_instance(); + GncQuotes quotes; if (quotes.cmd_result() == 0) { std::cout << bl::format (bl::translate ("Found Finance::Quote version {1}.")) % quotes.version() << std::endl; diff --git a/gnucash/gnucash.cpp b/gnucash/gnucash.cpp index b90e39a37b..544fdeb4cd 100644 --- a/gnucash/gnucash.cpp +++ b/gnucash/gnucash.cpp @@ -176,7 +176,7 @@ scm_run_gnucash (void *data, [[maybe_unused]] int argc, [[maybe_unused]] char ** /* Install Price Quote Sources */ auto msg = bl::translate ("Checking Finance::Quote...").str(gnc_get_boost_locale()); - auto quotes = gnc_get_quotes_instance(); + GncQuotes quotes; if (quotes.cmd_result() == 0) { msg = (bl::format (bl::translate("Found Finance::Quote version {1}.")) % quotes.version()).str(gnc_get_boost_locale()); diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp index 97b4887ade..0d496aa7c5 100644 --- a/libgnucash/app-utils/gnc-quotes.cpp +++ b/libgnucash/app-utils/gnc-quotes.cpp @@ -51,8 +51,6 @@ namespace bp = boost::process; namespace bpt = boost::property_tree; namespace bio = boost::iostreams; -static GncQuotes quotes_cached; -static bool quotes_initialized = false; CommVec gnc_quotes_get_quotable_commodities(const gnc_commodity_table * table); @@ -256,19 +254,3 @@ gnc_quotes_get_quotable_commodities (const gnc_commodity_table * table) //LEAVE ("list head %p", &l); return l; } - -const GncQuotes& gnc_get_quotes_instance() -{ - // The GncQuotes constructor runs check to test if Finance::Quote is properly installed - // However due to a race condition the instantiation of the static quotes_cached - // may or may not happen before binreloc has run. If binreloc didn't run, this will - // try to run gnc-fq-check from the hard-coded install dir. This will fail in all - // cases where binreloc is relevant (Windows, macOS or run from builddir). - // To catch this, explicitly reinstantiate quotes_cached at first use. - if (!quotes_initialized) - { - quotes_cached = GncQuotes(); - quotes_initialized = true; - } - return quotes_cached; -} diff --git a/libgnucash/app-utils/gnc-quotes.hpp b/libgnucash/app-utils/gnc-quotes.hpp index 8058813a98..504e620432 100644 --- a/libgnucash/app-utils/gnc-quotes.hpp +++ b/libgnucash/app-utils/gnc-quotes.hpp @@ -60,6 +60,4 @@ private: std::string m_error_msg; }; -const GncQuotes& gnc_get_quotes_instance (void); - #endif /* GNC_QUOTES_HPP */