Threading problem : Xlib: unexpected async reply (sequence 0x4b4)

Hello,

I have a frame with a notebook inside.

I have several notebook pages that contains information that are long to be displayed.

I want to add a page once this page is build, while other pages are sequencially build in background. So the user can start quickly working on the early pages.

I've made a single thread that fire an event once it has finish to build a panel. In this custom event, there's a panel property that contains the panel to be dispayed in the notebook page.

In the main frame there's a callback that handle this event and should add the panel to the notebook. but I've got this error :

Xlib: unexpected async reply (sequence 0x4b4)!
Gdk-ERROR **: Fatal IO error 0 (Success) on X server :0.0.

note that sequence number varries...

I don't know what to lock, as my worker thread is the only one to access the notebook...

Are widget creation not allowed in threads ? It's the only explanation i've found :frowning:

Thanks for any suggestion

François Girault

Hello,

I have a frame with a notebook inside.

I have several notebook pages that contains information that are long
to be displayed.

What type of information? Images? URLS? Database views?

I want to add a page once this page is build, while other pages are
sequencially build in background. So the user can start quickly
working on the early pages.

[snip]

Are widget creation not allowed in threads ? It's the only explanation
i've found :frowning:

This is indeed the problem. All calls to wxPython must be made from the
same thread that originally imported wxPython.

Thanks for any suggestion

Well, depending on the type of data being displayed, perhaps you could
just generate the data in a thread rather than the entire panel. This
would be the most common approach (or second most common - most common
being making the user wait <wink>).

If you must generate the actual panel, perhaps you could use an
intermediary step, such as generating XML and using wxXMLResource to
load it in the main thread. I haven't actually tried anything like
that, but it sounds good on paper :wink:

Regards,

···

On Tue, 2003-07-15 at 09:03, François Girault wrote:

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 (800) 735-0555

What type of information? Images? URLS? Database views?

It's about complex database forms

> Are widget creation not allowed in threads ? It's the only explanation
> i've found :frowning:

This is indeed the problem. All calls to wxPython must be made from the
same thread that originally imported wxPython.

All right, that's I wanted to know.

Well, depending on the type of data being displayed, perhaps you could
just generate the data in a thread rather than the entire panel. This
would be the most common approach (or second most common - most common
being making the user wait <wink>).

If you must generate the actual panel, perhaps you could use an
intermediary step, such as generating XML and using wxXMLResource to
load it in the main thread. I haven't actually tried anything like
that, but it sounds good on paper :wink:

Yes, I think it's the best solution, but it seems a little ambitious. Perhaps I'll try to make it in a futur release

Thanks for your help,

François Girault

Are you aware of the wxCallAfter() function?

wxCallAfter(myfunc, *args) calls myfunc with arguments *args when
control returns to the MainLoop. It is threadsafe and is typically used
to call wxWindows functions from other threads in a safe manner.

Bryan

···

On Tue, 2003-07-15 at 17:03, François Girault wrote:

Hello,

I have a frame with a notebook inside.

I have several notebook pages that contains information that are long to be displayed.

I want to add a page once this page is build, while other pages are sequencially build in background. So the user can start quickly working on the early pages.

I've made a single thread that fire an event once it has finish to build a panel. In this custom event, there's a panel property that contains the panel to be dispayed in the notebook page.

In the main frame there's a callback that handle this event and should add the panel to the notebook. but I've got this error :

Xlib: unexpected async reply (sequence 0x4b4)!
Gdk-ERROR **: Fatal IO error 0 (Success) on X server :0.0.

note that sequence number varries...

I don't know what to lock, as my worker thread is the only one to access the notebook...

Are widget creation not allowed in threads ? It's the only explanation i've found :frowning:

Thanks for any suggestion

François Girault

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382