X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5d3e7b52d84580c28df8f754b81363502f917ac7..ce76f779c6cfd2155de825021cc645572fe43625:/src/common/http.cpp diff --git a/src/common/http.cpp b/src/common/http.cpp index 990e08e276..bea35a2335 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -24,7 +24,12 @@ #include #include + +#ifndef WX_PRECOMP #include "wx/string.h" +#include "wx/app.h" +#endif + #include "wx/tokenzr.h" #include "wx/socket.h" #include "wx/protocol/protocol.h" @@ -232,11 +237,10 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) SetHeader(wxT("User-Agent"), wxT("wxWidgets 2.x")); SaveState(); -#if wxUSE_THREADS - SetFlags( wxThread::IsMain() ? wxSOCKET_NONE : wxSOCKET_BLOCK ); -#else - SetFlags( wxSOCKET_NONE ); -#endif + + // we may use non blocking sockets only if we can dispatch events from them + SetFlags( wxIsMainThread() && wxApp::IsMainLoopRunning() ? wxSOCKET_NONE + : wxSOCKET_BLOCK ); Notify(false); wxString buf;