]> git.saurik.com Git - wxWidgets.git/commitdiff
don't use non blocking sockets if wxApp::IsMainLoopRunnning() returns false (closes...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Oct 2004 10:52:32 +0000 (10:52 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Oct 2004 10:52:32 +0000 (10:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29646 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/http.cpp

index 990e08e276729ae20cb70d06dc5e8e1f7c481a94..d65d37f9cb7b7c6b5d66e512bf50da8dcf1b0a31 100644 (file)
@@ -232,11 +232,11 @@ 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() && (wxTheApp && wxTheApp->IsMainLoopRunning())
+                ? wxSOCKET_NONE
+                : wxSOCKET_BLOCK );
   Notify(false);
 
   wxString buf;