[PyQt] Crash with QAxContainer.QAxWidget

Patrick Hartling patrick.hartling at priority5.com
Fri Oct 24 02:43:02 BST 2008


I have been tracking down a crash when using QAxContainer.QAxWidget  
from PyQt 4.4.3 built against Qt 4.4.1. At this point, I believe that  
there is an issue with how a meta object gets associated with  
sipQAxContainerQAxWidget. Specifically, the sipTypeDef instantiated at  
the end of the generated file QAxContainer/ 
sipQAxContainerQAxWidget.cpp gets its td_qt data member initialized  
with the value 0. The result is that  
sipQAxContainerQAxWidget::metaObject() returns NULL, and since  
QMetaObject::cast() expects to get back a non-NULL value, a crash  
occurs. The behavior can be seen by running the web browser example in  
examples/activeqt/webbrowser in the PyQt source tree. The C++ version  
of web browser example from Qt works without problems.

If I modify qaxbase.h to make QAxBase::staticMetaObject public,  
rebuild Qt, and then change the generated QAxContainer/ 
sipQAxContainerQAxWidget.cpp so that the td_qt data member is  
initialized to the address of QAxBase::staticMetaObject, then the  
crash is fixed. However, I get the following warnings at run time from  
Qt:

Object::connect: No such slot QWidget::GoBack()
Object::connect:  (sender name:   'actionBack')
Object::connect:  (receiver name: 'WebBrowser')
Object::connect: No such slot QWidget::GoForward()
Object::connect:  (sender name:   'actionForward')
Object::connect:  (receiver name: 'WebBrowser')
Object::connect: No such slot QWidget::Stop()
Object::connect:  (sender name:   'actionStop')
Object::connect:  (receiver name: 'WebBrowser')
Object::connect: No such slot QWidget::Refresh()
Object::connect:  (sender name:   'actionRefresh')
Object::connect:  (receiver name: 'WebBrowser')
Object::connect: No such slot QWidget::GoHome()
Object::connect:  (sender name:   'actionHome')
Object::connect:  (receiver name: 'WebBrowser')
Object::connect: No such slot QWidget::GoSearch()
Object::connect:  (sender name:   'actionSearch')
Object::connect:  (receiver name: 'WebBrowser')

That suggests that I am still not quite on the right track. I also  
tried using the address of QWidget::staticMetaObject, and that gives  
the same results. It has the benefit of not requiring a modification  
to the Qt source.

I realize that this is a lot of conjecture on my part. Has anyone seen  
problems with QAxContainer.QAxWidget? Is there some other way of  
handling the problem that I described above with the initialization of  
the sipTypeDef in QAxContainer/sipQxContainerQAxWidget.cpp?

  -Patrick


--
Patrick L. Hartling
Senior Software Engineer, Priority 5
http://www.priority5.com/

The information transmitted in this communication is intended only for
the person or entity to which it is addressed and contains proprietary
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please destroy any copies, contact the sender
and delete the material from any computer.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20081024/e7108d2f/PGP.bin


More information about the PyQt mailing list