无法追踪Qt程序中的崩溃原因

时间:2016-11-08 15:13:55

标签: c++ qt debugging

我们正在开发Qt(https://github.com/IENT/YUView/)中的原始数据视频播放器。我们最近遇到了一个问题,我们的播放器崩溃了。我们无法在调试器中跟踪原因,它似乎发生在Qt内部的某处,请参阅下面的跟踪。

基本上我们遇到了如何查找问题的问题。关于如何处理的任何想法?

问题仅发生在Linux机器上(已经测试过不同的Qt版本),而不是在Windows上。它与某些文件之间的打开和切换有关,但它只是偶尔发生,我们不能故意触发它,而是必须多次在文件之间切换直到它发生。这可以立即或在几分钟之后。

以下是问题的痕迹:

0   QFontEngineFT::loadGlyphSet /usr/lib/debug/.build-id/c9/2e9e9dc3a4cf1f0133535e22d8ad76aa855d38.debug    1338    0x7fffeeed597a  
1   QFontEngineFT::loadGlyphFor /usr/lib/debug/.build-id/c9/2e9e9dc3a4cf1f0133535e22d8ad76aa855d38.debug    1795    0x7fffeeed59f8  
2   QFontEngineFT::lockedAlphaMapForGlyph   /usr/lib/debug/.build-id/c9/2e9e9dc3a4cf1f0133535e22d8ad76aa855d38.debug    1763    0x7fffeeed6ac4  
3   QRasterPaintEngine::drawCachedGlyphs    /usr/lib/debug/.build-id/81/2089dc48198b2723d82741c41011f463a732c0.debug    2760    0x7ffff75280f1  
4   QRasterPaintEngine::drawTextItem    /usr/lib/debug/.build-id/81/2089dc48198b2723d82741c41011f463a732c0.debug    3036    0x7ffff752ac5f  
5   QPainterPrivate::drawTextItem   /usr/lib/debug/.build-id/81/2089dc48198b2723d82741c41011f463a732c0.debug    6500    0x7ffff75482d1  
6   QTextLine::draw /usr/lib/debug/.build-id/81/2089dc48198b2723d82741c41011f463a732c0.debug    2532    0x7ffff73d5c5d  
7   QTextLayout::draw   /usr/lib/debug/.build-id/81/2089dc48198b2723d82741c41011f463a732c0.debug    1192    0x7ffff73d6a0d  
8   QWidgetLineControl::draw    /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    629 0x7ffff7a8240b  
9   QLineEdit::paintEvent   /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    1986    0x7ffff79f6038  
10  QWidget::event  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    9044    0x7ffff78e7f88  
11  QLineEdit::event    /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    1456    0x7ffff79fb349  
12  QApplicationPrivate::notify_helper  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    3716    0x7ffff78a505c  
13  QApplication::notify    /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    3499    0x7ffff78aa516  
14  QCoreApplication::notifyInternal    /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    965 0x7ffff6fb238b  
15  QCoreApplication::sendSpontaneousEvent  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    227 0x7ffff78e0a79  
16  QWidgetPrivate::sendPaintEvent  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5625    0x7ffff78e0a79  
17  QWidgetPrivate::drawWidget  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5565    0x7ffff78e10c1  
18  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5760    0x7ffff78e1d6c  
19  QWidgetPrivate::drawWidget  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5617    0x7ffff78e0c31  
20  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5760    0x7ffff78e1d6c  
21  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5747    0x7ffff78e1c59  
22  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5747    0x7ffff78e1c59  
23  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5747    0x7ffff78e1c59  
24  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5747    0x7ffff78e1c59  
25  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5747    0x7ffff78e1c59  
26  QWidgetPrivate::drawWidget  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5617    0x7ffff78e0c31  
27  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5760    0x7ffff78e1d6c  
28  QWidgetPrivate::drawWidget  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5617    0x7ffff78e0c31  
29  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5760    0x7ffff78e1d6c  
30  QWidgetPrivate::drawWidget  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5617    0x7ffff78e0c31  
31  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5760    0x7ffff78e1d6c  
32  QWidgetPrivate::drawWidget  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5617    0x7ffff78e0c31  
33  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5760    0x7ffff78e1d6c  
34  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5747    0x7ffff78e1c59  
35  QWidgetPrivate::paintSiblingsRecursive  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5747    0x7ffff78e1c59  
36  QWidgetPrivate::drawWidget  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    5617    0x7ffff78e0c31  
37  QWidgetBackingStore::doSync /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    1226    0x7ffff78b28aa  
38  QWidgetBackingStore::sync   /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    1032    0x7ffff78b2a8c  
39  QWidgetPrivate::syncBackingStore    /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    1902    0x7ffff78d0c1f  
40  QWidget::event  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    8983    0x7ffff78e7d88  
41  QMainWindow::event  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    1495    0x7ffff79fdd7b  
42  QApplicationPrivate::notify_helper  /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    3716    0x7ffff78a505c  
43  QApplication::notify    /usr/lib/debug/.build-id/d5/2143d1747e6970d9ecdc0538c5c9170af15963.debug    3499    0x7ffff78aa516  
44  QCoreApplication::notifyInternal    /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    965 0x7ffff6fb238b  
45  QCoreApplication::sendEvent /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    224 0x7ffff6fb4786  
46  QCoreApplicationPrivate::sendPostedEvents   /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    1593    0x7ffff6fb4786  
47  QCoreApplication::sendPostedEvents  /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    1451    0x7ffff6fb4c68  
48  postEventSourceDispatch /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    271 0x7ffff70083c3  
49  g_main_context_dispatch         0x7ffff57691a7  
50  ??          0x7ffff5769400  
51  g_main_context_iteration            0x7ffff57694ac  
52  QEventDispatcherGlib::processEvents /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    418 0x7ffff70087cf  
53  QEventLoop::exec    /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    204 0x7ffff6fafb4a  
54  QCoreApplication::exec  /usr/lib/debug/.build-id/53/070dadaef9fa7fb45640b17d77ee3aeeac7b13.debug    1229    0x7ffff6fb7bec  
55  main    yuviewapp.cpp   84  0x4b16e9    

1 个答案:

答案 0 :(得分:1)

The segfault happens in QFontEngineFT::loadGlyphSet(const QTransform &matrix) at line 1338 in Qt 5.5.

1334 if (matrix.type() > QTransform::TxShear || !cacheEnabled)
1335    return 0;
1336
1337 // FT_Set_Transform only supports scalable fonts
1338 if (!FT_IS_SCALABLE(freetype->face))
1339    return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : Q_NULLPTR;

IMHO this is a bug in Qt and it is not fixed in Qt 5.7 yet. However, one possible workaround could be to force the return statement to happen. This could be done by setting the following environment varibale:

export QT_NO_FT_CACHE=1