[C++-sig] Can boost.python and PyQt be used together?

Marcelo A. Camelo camelo at esss.com.br
Tue Dec 10 18:20:32 CET 2002


>>> Another possible conflict, perhaps more likely, is the two 
>>> modules fighting over the Qt API.

>> Could you be a little more specific about what this might mean?

> Not really - just an uncomfortable feeling about events being 
> dispatched from an object wrapped by one module to an object 
> wrapped by another module that calls a virtual re-implemented 
> in the first module etc, etc.

I'm having a very similar problem. 

I'm using boost::python to wrap C++/Win32/DirectX code and I'm 
also using PyQt to create user interfaces. 

In three similar situations I've got the infamous error
"Fatal Error: Thread state is Null" (or something like that).

I haven't nailed down the bug yet, but I've found that it is 
related to calling back my C++/Win32/DirectX library (wrapped in 
boost) from an event triggered from Qt main event loop.

Not every callback will fail. Some Win32 api calls will make it
fail (SetWindowPos will make it fail, MoveWindow won't). Some 
DirectX calls also fail (if I comment those calls, everything 
goes fine).

The error is generated after the wrapped method call has been 
completed, but before control is passed back to python.

I've also had some problems related to Win32 message queue. The
WindowProc message for my own Window Classes is being called 
from the Qt main event loop. If I dispatch those messages and
generate events to python code that calls back to my C++ 
library, bang!!! In this case, I don't know if the crash only
occurs when making win32 API calls.

Hope this information is of some value.


Cheers, 
 

Marcelo A. Camelo, M. Eng. - Project Leader
ESSS - Engineering Simulation and Scientific Software
 
E-mail: camelo at esss.com.br
Phone: +55-48-239-2226
 






More information about the Cplusplus-sig mailing list