Package: python-qt3
Version: 3.17.4-1
Severity: grave

--- Please enter the report below this line. ---
Hi,

since two weeks reportbug-ng, which uses python-qt3, segfaults very often. I've investigated the problem and think the problem comes from the qt3-bindings or some of it's underlying libs.

The problem appears very often when reportbug-ng tries to show a bugreport in it's internal browser via

  QTextBrowser.setText(somehtml)

I've tried to get more info via gdb. Here is a typical stack trace:

(gdb) run /usr/bin/rng
Starting program: /usr/bin/python-dbg /usr/bin/rng
[Thread debugging using libthread_db enabled]
[New Thread 0xb7d7d8c0 (LWP 22913)]
[New Thread 0xb63bdb90 (LWP 22921)]
[Thread 0xb63bdb90 (LWP 22921) exited]
[New Thread 0xb63bdb90 (LWP 22925)]
[Thread 0xb63bdb90 (LWP 22925) exited]
[New Thread 0xb63bdb90 (LWP 22929)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb63bdb90 (LWP 22929)]
0xb6e8c1fd in QFontMetrics::lineSpacing () from /usr/lib/libqt-mt.so.3
(gdb) bt
#0  0xb6e8c1fd in QFontMetrics::lineSpacing () from /usr/lib/libqt-mt.so.3
#1  0xb6f4ec07 in QTextFormat::applyFont () from /usr/lib/libqt-mt.so.3
#2  0xb6f1773c in QTextFormat::width () from /usr/lib/libqt-mt.so.3
#3  0xb6f2708d in QTextString::width () from /usr/lib/libqt-mt.so.3
#4 0xb6f27685 in QTextFormatterBreakWords::format () from /usr/lib/libqt-mt.so.3
#5  0xb6f1a57e in QTextParagraph::format () from /usr/lib/libqt-mt.so.3
#6  0xb7020047 in QTextEdit::formatMore () from /usr/lib/libqt-mt.so.3
#7  0xb702b7d3 in QTextEdit::setText () from /usr/lib/libqt-mt.so.3
#8  0xb701d16d in QTextBrowser::setText () from /usr/lib/libqt-mt.so.3
#9 0xb7693359 in sipQTextBrowser::setText (this=0x949d458, [EMAIL PROTECTED], [EMAIL PROTECTED]) at sipqtpart5.cpp:2493 #10 0xb7697385 in QTextBrowser::setText (this=0x949d458, [EMAIL PROTECTED]) at /usr/share/qt3/include/qtextbrowser.h:74 #11 0xb7683e8d in meth_QTextBrowser_setText (sipSelf=0x942dadc, sipArgs=0x9433bcc) at sipqtpart5.cpp:9944 #12 0x081499c2 in PyCFunction_Call (func=0x9437c3c, arg=0x9433bcc, kw=0x0) at ../Objects/methodobject.c:73 #13 0x080ec2de in call_function (pp_stack=0xb63bcf04, oparg=1) at ../Python/ceval.c:3573 #14 0x080e7adf in PyEval_EvalFrameEx (f=0x94e6e94, throwflag=0) at ../Python/ceval.c:2272 #15 0x080e9fb8 in PyEval_EvalCodeEx (co=0x904f5c8, globals=0x9046e94, locals=0x0, args=0x942a0b8, argcount=2, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:2836 #16 0x081490fe in function_call (func=0x940fe44, arg=0x942a0a4, kw=0x0) at ../Objects/funcobject.c:517 #17 0x080625c9 in PyObject_Call (func=0x940fe44, arg=0x942a0a4, kw=0x0) at ../Objects/abstract.c:1861 #18 0x0806b93d in instancemethod_call (func=0x940fe44, arg=0x942a0a4, kw=0x0) at ../Objects/classobject.c:2519 #19 0x080625c9 in PyObject_Call (func=0x9661634, arg=0x942a654, kw=0x0) at ../Objects/abstract.c:1861 #20 0x080ebaec in PyEval_CallObjectWithKeywords (func=0x9661634, arg=0x942a654, kw=0x0) at ../Python/ceval.c:3442 #21 0x0812200d in t_bootstrap (boot_raw=0x95fc168) at ../Modules/threadmodule.c:424
#22 0xb7f0e4b0 in start_thread () from /lib/i686/cmov/libpthread.so.0
#23 0xb7e5e38e in clone () from /lib/i686/cmov/libc.so.6


I noticed that almost everytime something about Fonts is in the very first line, like QFontMetrics::width() or ::lineSpacing() or something.

I also noticed that this happens almost only when html text is involved. If I just provide plain text, the segfaults are very rare.

I've attached a small script where you can test it your self. Start it with some text (html or plain) as parameter:

  python crash.py "some text"
  python crash.py "<b>some evil text</b>

while the first call will crash very seldom, the second one should cause a segfault roughly every second time you call it.

I've set the severity to grave since it causes other programs to crash. I could be possible, that not python-qt3 but one if it's underlying libs is the problem but I'm not sure, so I'm assigning it to your package. I've already asked on d-devel and someone pointed out that this problem could be related to the new GCC version and some optimization flags. I've already build python-qt3 with -g -O0 but without success.


Cheers,

Bastian

--- System information. ---
Architecture: i386
Kernel:       Linux 2.6.25-2-686

Debian Release: lenny/sid
  500 unstable        ftp.de.debian.org
    1 unstable        www.debian-multimedia.org

--- Package information. ---
Depends            (Version) | Installed
============================-+-=============
libc6             (>= 2.7-1) | 2.7-12
libgcc1         (>= 1:4.2.1) | 1:4.3.1-6
libqt3-mt       (>= 3:3.3.7) | 3:3.3.8b-5
libstdc++6        (>= 4.2.1) | 4.3.1-6
libx11-6                     | 2:1.1.4-2
libxext6                     | 2:1.0.4-1
python              (<< 2.6) | 2.5.2-1
python              (>= 2.4) | 2.5.2-1
python-sip4         (<= 4.8) | 4.7.6-1
python-sip4         (>= 4.7) | 4.7.6-1

from qt import *
import sys
import threading

class Form(QMainWindow):
    def __init__(self,parent = None,name = None,fl = 0):
        QMainWindow.__init__(self,parent,name,fl)
        self.browser = QTextBrowser(self, "browser")
        self.setCentralWidget(self.browser)

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print 'Usage: %s "some text"' % sys.argv[0]
        sys.exit()
    s = str(sys.argv[1])
    
    # setup qt stuff with a browser
    app = QApplication(sys.argv)
    app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    form = Form()
    app.setMainWidget(form)
    form.show()
   
    # start a different thread and try to set the text in the browser
    # we wait 1.0 second -- just to make sure the change happens after the
    # start of app.exec_loop() below
    t = threading.Timer(1.0, form.browser.setText, (s, ))
    t.start()
    
    app.exec_loop()
    

Reply via email to