diff options
author | Robin Gareus <robin@gareus.org> | 2017-08-31 19:33:51 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-08-31 20:08:47 +0200 |
commit | e544934780ac4e3afd5878f3cc02e4acacedbd67 (patch) | |
tree | 85efdad9e8fa2108f5ccb760e52c63f66ef18148 | |
parent | 720292696a94c96d764e74b5e84fce09a1b3621c (diff) |
Call curl_global_init() exactly only once (1/2)
-rw-r--r-- | gtk2_ardour/ardour_http.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/main.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/sfdb_freesound_mootcher.cc | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/gtk2_ardour/ardour_http.cc b/gtk2_ardour/ardour_http.cc index 2b16ccc2c5..ecbe76935c 100644 --- a/gtk2_ardour/ardour_http.cc +++ b/gtk2_ardour/ardour_http.cc @@ -59,8 +59,6 @@ HttpGet::setup_certificate_paths () */ assert (!ca_path && !ca_info); // call once - curl_global_init (CURL_GLOBAL_DEFAULT); - if (Glib::file_test ("/etc/pki/tls/certs/ca-bundle.crt", Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { // Fedora / RHEL, Arch ca_info = "/etc/pki/tls/certs/ca-bundle.crt"; diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 9c9981bcc3..65ce353817 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -31,6 +31,8 @@ #include <fftw3.h> #endif +#include <curl/curl.h> + #include "pbd/error.h" #include "pbd/file_utils.h" #include "pbd/textreceiver.h" @@ -288,6 +290,11 @@ int main (int argc, char *argv[]) { ARDOUR::check_for_old_configuration_files(); + /* global init is not thread safe.*/ + if (curl_global_init (CURL_GLOBAL_DEFAULT)) { + cerr << "curl_global_init() failed. The web is gone. We're all doomed." << endl; + } + fixup_bundle_environment (argc, argv, localedir); load_custom_fonts(); /* needs to happen before any gtk and pango init calls */ diff --git a/gtk2_ardour/sfdb_freesound_mootcher.cc b/gtk2_ardour/sfdb_freesound_mootcher.cc index 1f2487b5e7..51c195657b 100644 --- a/gtk2_ardour/sfdb_freesound_mootcher.cc +++ b/gtk2_ardour/sfdb_freesound_mootcher.cc @@ -142,8 +142,6 @@ std::string Mootcher::sortMethodString(enum sortMethod sort) //------------------------------------------------------------------------ void Mootcher::setcUrlOptions() { - // basic init for curl - curl_global_init(CURL_GLOBAL_ALL); // some servers don't like requests that are made without a user-agent field, so we provide one curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0"); // setup curl error buffer |