wx2.8.3 problem: wxFileSystem and event-based sockets

Yuri Borsky borsky at sbor.ru
Thu Apr 12 05:56:51 PDT 2007


Hi all!

This is kind of response to my previous post but I think that issue is
serious enougth that top-level thread is OK.

Anyway: the problem is that you will get event processing during
wxFileSystem::OpenFile() call via http (at least) protocol.
This is because wx will do event processing internally while waiting for
HTTP response on underlying GSocket.
Such events may include paint, user input, timers etc.

One problem is that application may not expect paint event in the middle of
data loading, when some files are loaded and some are not yet.

Another problem is that current scheme seems broken at least for wxMSW2.8.3:
doing this from MyApp::OnInit() makes one layer
(wxHTTP) think that event loop is not yet available but another layer
(GSocket::Select()) thinks that it is absolutely OK to use event loop - and
stuck.

I was able to correct this for me by modifying gsocket.cpp GSocket::Select()
function to skip CanUseEventLoop() check and
allways use direct select on socket. It works for me as I dont' use
wxSockets any other way.

But I understand that the real issue is that logically
wxFileSystem::OpenFile() should be atomic, ie there should not be any
app-wide event processing inside that call. But that requires to modify
underlying wx internals that I dont' understand well enougth :(

regards
    Yuri









More information about the wx-users mailing list