Check curl_multi_init() return value
Return NULL wxWebRequest if this function fails. Also get rid of another unnecessary Initialize() function.
This commit is contained in:
@@ -133,8 +133,6 @@ private:
|
||||
wxMutex m_cancelledMutex;
|
||||
wxVector< wxObjectDataPtr<wxWebRequestCURL> > m_cancelledRequests;
|
||||
|
||||
void Initialize();
|
||||
|
||||
static int ms_activeSessions;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebSessionCURL);
|
||||
|
@@ -377,15 +377,18 @@ wxWebSessionCURL::~wxWebSessionCURL()
|
||||
curl_global_cleanup();
|
||||
}
|
||||
|
||||
void wxWebSessionCURL::Initialize()
|
||||
{
|
||||
m_handle = curl_multi_init();
|
||||
}
|
||||
|
||||
wxWebRequest* wxWebSessionCURL::CreateRequest(const wxString& url, int id)
|
||||
{
|
||||
// Allocate our handle on demand.
|
||||
if ( !m_handle )
|
||||
Initialize();
|
||||
{
|
||||
m_handle = curl_multi_init();
|
||||
if ( !m_handle )
|
||||
{
|
||||
wxLogDebug("curl_multi_init() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return new wxWebRequestCURL(*this, id, url);
|
||||
}
|
||||
|
Reference in New Issue
Block a user