PDA

View Full Version : segfault in qtfontdatabase_x11.cpp



e8johan
23rd March 2006, 15:41
I'm trying to get Qt 4.1.1. to work in coLinux/debian. I've compiled a static version of Qt and I can run non-graphical applications. However, as soon as I try to run something graphical such as designer or assistant I get segfaults. To debug, I started out with this minimal application:


#include <QApplication>
#include <QMessageBox>

int main( int argc, char **argv )
{
QApplication a( argc, argv );

QMessageBox::information( 0, "", "Now it works!" );

return 0;
}

The application builds and work with the message box line commented out, but when I try to run it in the shape that it is above, I get the follow backtrace from gdb:


(gdb) run
Starting program: /home/johan/coding/testall/testall
[Thread debugging using libthread_db enabled]
[New Thread -1220707488 (LWP 481)]
Qt: gdb: -nograb added to command-line options.
Use the -dograb option to enforce grabbing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1220707488 (LWP 481)]
0xb7be83c5 in QFontDatabase::loadXlfd (screen=0, script=0,
request=@0xbfffc890, force_encoding_id=-1) at qfontdatabase_x11.cpp:1678
1678 qfontdatabase_x11.cpp: No such file or directory.
in qfontdatabase_x11.cpp
(gdb) bt
#0 0xb7be83c5 in QFontDatabase::loadXlfd (screen=0, script=0,
request=@0xbfffc890, force_encoding_id=-1) at qfontdatabase_x11.cpp:1678
#1 0xb7be884a in QFontDatabase::load (d=0x806f968, script=0)
at qfontdatabase_x11.cpp:1751
#2 0xb7b71fae in QFontPrivate::engineForScript (this=0x806f968, script=0)
at qfont_p.h:155
#3 0xb7be3787 in QFontMetricsF::leading (this=0xbffff370)
at text/qfontmetrics.cpp:1047
#4 0xb7b6e8c6 in qt_format_text (fnt=@0xbffff420, _r=@0xbffff430,
tf=134236177, str=@0xbffff570, brect=0xbffff450, tabstops=0,
tabarraylen=0, painter=0x0) at painting/qpainter.cpp:5527
#5 0xb7be2f57 in QFontMetrics::boundingRect (this=0xbffff550, r=@0xbffff4b0,
flgs=2048, str=@0xbffff570, tabstops=0, tabarray=0x0)
at text/qfontmetrics.cpp:688
#6 0xb7be301b in QFontMetrics::size (this=0xbffff550, flgs=2048,
text=@0xbffff570, tabstops=0, tabarray=0x0) at text/qfontmetrics.cpp:720
#7 0xb7d95494 in QPushButton::sizeHint (this=0x8077778)
at widgets/qpushbutton.cpp:379
#8 0xb7e29e77 in QMessageBox::resizeEvent (this=0xbffff830)
at dialogs/qmessagebox.cpp:922
#9 0xb7ab54d8 in QWidget::event (this=0xbffff830, event=0xbffff7a0)
at kernel/qwidget.cpp:5140
#10 0xb7e299c2 in QMessageBox::setButtonText (this=0xbffff830, button=1,
---Type <return> to continue, or q <return> to quit---
text=@0xbffff820) at dialogs/qmessagebox.cpp:840
#11 0xb7e2ac63 in textBox (parent=0x0, severity=Information,
caption=@0xbffff8f0, text=@0xbffff900, button0Text=@0xbffff910,
button1Text=@0xbffff920, button2Text=@0xbffff930, defaultButtonNumber=0,
escapeButtonNumber=-1) at dialogs/qmessagebox.cpp:1311
#12 0xb7e2adbe in QMessageBox::information (parent=0x0, caption=@0xbffff8f0,
text=@0xbffff900, button0Text=@0xbffff910, button1Text=@0xbffff920,
button2Text=@0xbffff930, defaultButtonNumber=0, escapeButtonNumber=-1)
at dialogs/qmessagebox.cpp:1367
#13 0x08048abf in main (argc=1, argv=0xbffff9e4) at main.cpp:8

To me, it looks like it is desc.size->count that fails somehow:


...
QList<int> encodings;
if (desc.encoding)
encodings.append(int(desc.encoding->encoding));

// append all other encodings for the matched font
for (int i = 0; i < desc.size->count; ++i) {
QtFontEncoding *e = desc.size->encodings + i;
if (e == desc.encoding)
continue;
encodings.append(int(e->encoding));
...

jacek
23rd March 2006, 17:21
http://www.trolltech.com/developer/tasktracker.html?method=entry&id=104979

e8johan
23rd March 2006, 18:31
Thanks - I really need to learn to search the db.

e8johan
18th April 2006, 07:07
I've finally come around and build Qt 4.1.2. Now, the screen looks like this (http://www.digitalfanatics.org/e8johan/no-fonts.png)when I start Designer. Does anyone know what might be wrong? Am I missing a fonts package (running Debian)? Am I the only one running into this?