[PyQt] Crash with QAxContainer.QAxWidget

Phil Thompson phil at riverbankcomputing.com
Sun Oct 26 21:15:55 GMT 2008


On Fri, 24 Oct 2008 10:47:53 -0500, Patrick Hartling
<patrick.hartling at priority5.com> wrote:
> 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().

It's a SIP bug - fixed in tonight's snapshot.

Phil


More information about the PyQt mailing list