mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-03-30 05:46:55 +00:00
Protect against calling curl_easy_cleanup after curl_global_cleanup.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17103 Fixes KICAD-7DP
This commit is contained in:
parent
4eaadcae5c
commit
0c694de209
@ -120,7 +120,8 @@ static int progressinfo( void* aProgress, double aDLtotal, double aDLnow, double
|
||||
|
||||
|
||||
KICAD_CURL_EASY::KICAD_CURL_EASY() :
|
||||
m_headers( nullptr )
|
||||
m_headers( nullptr ),
|
||||
m_curlSharedLock( KICAD_CURL::Mutex() )
|
||||
{
|
||||
m_CURL = curl_easy_init();
|
||||
|
||||
@ -200,12 +201,6 @@ KICAD_CURL_EASY::~KICAD_CURL_EASY()
|
||||
|
||||
int KICAD_CURL_EASY::Perform()
|
||||
{
|
||||
std::shared_lock lock( KICAD_CURL::Mutex(), std::try_to_lock );
|
||||
|
||||
// If can't lock, we should be in the process of tearing down.
|
||||
if( !lock )
|
||||
return CURLE_ABORTED_BY_CALLBACK;
|
||||
|
||||
if( m_headers )
|
||||
curl_easy_setopt( m_CURL, CURLOPT_HTTPHEADER, m_headers );
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <shared_mutex>
|
||||
|
||||
typedef void CURL;
|
||||
struct curl_slist;
|
||||
@ -163,10 +164,11 @@ private:
|
||||
template <typename T>
|
||||
int setOption( int aOption, T aArg );
|
||||
|
||||
CURL* m_CURL;
|
||||
curl_slist* m_headers;
|
||||
std::string m_buffer;
|
||||
std::unique_ptr<CURL_PROGRESS> progress;
|
||||
CURL* m_CURL;
|
||||
curl_slist* m_headers;
|
||||
std::string m_buffer;
|
||||
std::unique_ptr<CURL_PROGRESS> progress;
|
||||
std::shared_lock<std::shared_mutex> m_curlSharedLock;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user