[PyKDE] Obscure bug in PyQt?

Phil Thompson phil at riverbankcomputing.co.uk
Tue Jan 20 23:29:00 GMT 2004


On Tuesday 20 January 2004 8:13 pm, Roberto Alsina wrote:
> Hello,
>
> Ok, this one is pretty hard to explain. I imagine understanding will be
> harder still :-)
>
> First of all: this same code worked with PyQt 3.8 (I think that was the
> version), but doesn't with 3.9 or 3.10
>
> Here's the story.
>
> WI want to make a QTextBrowser show images. To do that, I created my own
> QMimeSourceFactory which would download the stuff and return it on its
> data() method.
>
> The data has to be returned as a QMimeObject. Or rather, as something
> inheriting QMimeObject, like QTextDrag or QImageDrag.
>
> The problem is, somewhere things go wrong, and QMimeSource.provides is
> called instead of QTextDrag's or QImageDrag's. Since that is pure virtual,
> the app goes boom. Here's a backtrace:

QMimeSource.provides() isn't pure virtual and QTextDrag and QImageDrag don't 
reimplement it. I think it's format() that's the problem.

I'm confused by the fact that no SIP generated classes (ie. with a sip prefix) 
seem to be involved.

> #0  0x400ce671 in kill () from /lib/i686/libc.so.6
> #1  0x40039afd in pthread_kill () from /lib/i686/libpthread.so.0
> #2  0x40039e9b in raise () from /lib/i686/libpthread.so.0
> #3  0x400ce414 in raise () from /lib/i686/libc.so.6
> #4  0x400cf94b in abort () from /lib/i686/libc.so.6
> #5  0x40926b57 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.5
> #6  0x40926ba4 in std::terminate() () from /usr/lib/libstdc++.so.5
> #7  0x40927077 in __cxa_pure_virtual () from /usr/lib/libstdc++.so.5
> #8  0x40417e77 in QMimeSource::provides(char const*) const () from
> /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #9  0x403e3ace in QImageDrag::decode(QMimeSource const*, QImage&) () from
> /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #10 0x40477a3a in QTextImage::QTextImage(QTextDocument*, QMap<QString,
> QString> const&, QString const&, QMimeSourceFactory&) () from
> /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #11 0x4043acad in QStyleSheet::tag(QString const&, QMap<QString, QString>
> const&, QString const&, QMimeSourceFactory const&, bool, QTextDocument*)
> const () from /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #12 0x4045f822 in QTextDocument::setRichTextInternal(QString const&,
> QTextCursor*) ()
>    from /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #13 0x4045c5df in QTextDocument::setRichText(QString const&, QString
> const&) () from /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #14 0x40461dfa in QTextDocument::setText(QString const&, QString const&)
> () from /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #15 0x4053626c in QTextEdit::setText(QString const&, QString const&) ()
> from /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #16 0x4052ca2c in QTextBrowser::setText(QString const&, QString const&) ()
> from /usr/lib/qt-3.2/lib/libqt-mt.so.3
> #17 0x40e10134 in sipQTextBrowser::setText(QString const&, QString const&)
> ()
>
> It's not easy to provide a sample program that causes this (it's a part of
> a larger one, and tangled), but:
>
> a) I can try, if it's necessary

It would help.

You might also try passing the -r flag to configure.py when building PyQt and 
using [lib]sip.settracemask() to trace where the code is switching between 
C++ land and Python land.

What version of SIP are you using?

Phil




More information about the PyQt mailing list