Menu

#323 QwtScaleWidget: addition of QEvent::LayoutRequest causes 100% CPU in my app

open
nobody
None
5
2021-03-09
2020-11-05
Anonymous
No

The addition of "QwtScaleWidget: missing QEvent::LayoutRequest added" seems to cause 100% cpu. Not really sure why but the backtrace indicated that's the cause. I think the event starts a loop of infinite updates.

Thread 1 "MyApp" received signal SIGINT, Interrupt.
0x00007ffff5d0c066 in double_conversion::Bignum::Bignum() () from /usr/lib/libdouble-conversion.so.3
(gdb) bt
#0  0x00007ffff5d0c066 in double_conversion::Bignum::Bignum() () at /usr/lib/libdouble-conversion.so.3
#1  0x00007ffff5d0c74b in double_conversion::BignumDtoa(double, double_conversion::BignumDtoaMode, int, double_conversion::Vector<char>, int*, int*) () at /usr/lib/libdouble-conversion.so.3
#2  0x00007ffff5d0e3cf in double_conversion::DoubleToStringConverter::DoubleToAscii(double, double_conversion::DoubleToStringConverter::DtoaMode, int, char*, int, bool*, int*, int*) () at /usr/lib/libdouble-conversion.so.3
#3  0x00007ffff6a43ec3 in  () at /usr/lib/libQt5Core.so.5
#4  0x00007ffff6a37e62 in  () at /usr/lib/libQt5Core.so.5
#5  0x00007ffff6a384ad in  () at /usr/lib/libQt5Core.so.5
#6  0x00007ffff6a5c391 in QString::number(double, char, int) () at /usr/lib/libQt5Core.so.5
#7  0x00007ffff71f42d7 in QFont::toString() const () at /usr/lib/libQt5Gui.so.5
#8  0x00007ffff71f470f in QFont::key() const () at /usr/lib/libQt5Gui.so.5
#9  0x00007ffff7ec8aa3 in QwtPlainTextEngine::textMargins(QFont const&, QString const&, double&, double&, double&, double&) const () at /usr/lib/libqwt.so.6
#10 0x00007ffff7ecae70 in QwtText::textSize(QFont const&) const () at /usr/lib/libqwt.so.6
#11 0x00007ffff7ebae37 in QwtScaleDraw::labelRect(QFont const&, double) const () at /usr/lib/libqwt.so.6
#12 0x00007ffff7ebaf16 in QwtScaleDraw::labelSize(QFont const&, double) const () at /usr/lib/libqwt.so.6
#13 0x00007ffff7ebbea8 in QwtScaleDraw::maxLabelHeight(QFont const&) const () at /usr/lib/libqwt.so.6
#14 0x00007ffff7ebbff6 in QwtScaleDraw::extent(QFont const&) const () at /usr/lib/libqwt.so.6
#15 0x00007ffff7f1250f in QwtScaleWidget::dimForLength(int, QFont const&) const () at /usr/lib/libqwt.so.6
#16 0x00007ffff7efad29 in QwtPlotLayout::LayoutData::init(QwtPlot const*, QRectF const&) () at /usr/lib/libqwt.so.6
#17 0x00007ffff7efc4a6 in QwtPlotLayout::activate(QwtPlot const*, QRectF const&, QFlags<QwtPlotLayout::Option>) () at /usr/lib/libqwt.so.6
#18 0x00007ffff7ed3e5d in QwtPlot::updateLayout() () at /usr/lib/libqwt.so.6
#19 0x00007ffff7ed7530 in QwtPlot::event(QEvent*) () at /usr/lib/libqwt.so.6
#20 0x00007ffff7821752 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#21 0x00007ffff6bb9cda in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#22 0x00007ffff6bbc7d3 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#23 0x00007ffff6c13304 in  () at /usr/lib/libQt5Core.so.5
#24 0x00007ffff55df914 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#25 0x00007ffff56337d1 in  () at /usr/lib/libglib-2.0.so.0
#26 0x00007ffff55de121 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#27 0x00007ffff6c12941 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#28 0x00007ffff6bb865c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#29 0x00007ffff6bc0af4 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#30 0x0000555555627df8 in main(int, char**) (argc=1, argv=0x7fffffffdc28) at ../../../myapp/src/app/main.cpp:80

Discussion

  • Anonymous

    Anonymous - 2020-11-05

    Using Qt 5.15 and Qwt 6.1.5 (archlinux)

     
  • Uwe Rathmann

    Uwe Rathmann - 2020-11-07

    This is a typical stack, when the layout of the plot has to be recalculated,

    I'm not sure what you mean by "QwtScaleWidget: missing QEvent::LayoutRequest added" - is it related to the workaround in QwtScaleWidget::layoutScale ? If yes - why is it called so often in your application ?

     
  • Anonymous

    Anonymous - 2021-03-09

    Hi,
    I have found the same problem and it is related to the workaround in QwtScaleWidget::layoutScale.
    I solved it by adding a layout to the parent to skip the check:
    if ( !w->isVisible() && w->layout() == NULL )
    I believe, however, that the bug in the library is present: the conditions that involve the postEvent remain unchanged and the cycle repeats itself indefinitely.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB