[PyQt] Crash with QAxContainer.QAxWidget

Patrick Hartling patrick.hartling at priority5.com
Fri Oct 24 16:47:53 BST 2008


I apologize for replying to myself, but I discovered that I made an
error in my analysis. See below.

Patrick Hartling wrote:
> 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.

The above did not work. QAxBase::staticMetaObject is not instantiated.
Thus, making it public and trying to access the address of it results in
an unresolved symbol at link time. The only thing that has worked so far
to fix the crash is to use the address of QWidget::staticMetaObject, and
I think that that explains why I get the warnings shown below.

> 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?

At this point, I am pursuing some alternative approach to getting the
meta object for sipQxContainerQAxWidget. I don't know yet how it will
happen, but the address-of approach doesn't look like it will work. The
most likely solution I can see right now is trying to figure out some
way to invoke QAxWidget::metaObject().

 -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: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20081024/f6c8db28/signature.bin


More information about the PyQt mailing list