Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Totally confusing segmentation violation
Forum Updated to NodeBB v4.3 + New Features

Totally confusing segmentation violation

Scheduled Pinned Locked Moved Unsolved General and Desktop
24 Posts 6 Posters 9.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mstothM Offline
    mstothM Offline
    mstoth
    wrote on last edited by mstoth
    #1

    I have a problem which appears apparently randomly which is a SIGSEGV but the stack trace only has main() as a viewable level.

    The levels below main() of the stack are all grey and seem to terminate in a call to getenv. It happens when I make a change to my code and the change can be almost anything! I have to save my work after each small step just to make sure I don't have to back-track too far.
    There is a long list of function calls which are greyed out above the main() listing. The last call is to __GI_getenv(). When I run the code in gdb instead of the Qt environment, I see a stack trace with the following message

    Thread 1 "GenisysVoicesPa" received signal SIGSEGV, Segmentation fault.
    __GI_getenv (name=0x7fffee365b47 "_NO_FT_CACHE") at getenv.c:84
    84 getenv.c: No such file or directory.
    (gdb)

    On another occasion the string passed was "US_REGION" neither of these strings are in my code.
    I have no idea why this segmentation violation pops up and it seems to happen randomly in the course of my work.

    Sometimes if I go to a previous version that worked, and I return to the new version that didn't, the new version starts to work! So that seems to imply an environment issue but I'm not changing anything (that I know of) in my environment. If I had hair I'd be pulling it out!
    Can anyone help? please!
    Thank you,
    Michael Toth

    Here is the complete stack trace. The only line that is not grey is main().

    1  __GI_getenv                                                                                                                                                 getenv.c 84 0x7ffff611180d 
    2  qgetenv(const char *)                                                                                                                                                   0x7ffff6ac7121 
    3  QFontEngineFT::QFontEngineFT(QFontDef const&)                                                                                                                           0x7fffee329e78 
    4  ??                                                                                                                                                                      0x7fffee2f327c 
    5  ??                                                                                                                                                                      0x7ffff5ad6eec 
    6  QFontDatabase::findFont(QFontDef const&, int)                                                                                                                           0x7ffff5ad7524 
    7  QFontDatabase::load(QFontPrivate const *, int)                                                                                                                          0x7ffff5ad807d 
    8  QFontPrivate::engineForScript(int) const                                                                                                                                0x7ffff5aaf7f3 
    9  QFontMetricsF::leading() const                                                                                                                                          0x7ffff5acc621 
    10 ??                                                                                                                                                                      0x7ffff5c55af3 
    11 QPainter::drawText(QRect const&, int, QString const&, QRect *)                                                                                                          0x7ffff5c5c774 
    12 QStyle::drawItemText(QPainter *, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const                                                   0x7ffff730e9b7 
    13 QLabel::paintEvent(QPaintEvent *)                                                                                                                                       0x7ffff73ea458 
    14 QWidget::event(QEvent *)                                                                                                                                                0x7ffff72e6bd8 
    15 QFrame::event(QEvent *)                                                                                                                                                 0x7ffff73e3b9e 
    16 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                 0x7ffff72a3b9c 
    17 QApplication::notify(QObject *, QEvent *)                                                                                                                               0x7ffff72a7f00 
    18 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                  0x7ffff6ca6b80 
    19 QWidgetPrivate::sendPaintEvent(QRegion const&)                                                                                                                          0x7ffff72dfefa 
    20 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)                                                       0x7ffff72e050f 
    21 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e1274 
    22 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
    23 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
    24 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
    25 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)                                                       0x7ffff72e00b2 
    26 ??                                                                                                                                                                      0x7ffff72b09aa 
    27 ??                                                                                                                                                                      0x7ffff72b1085 
    28 ??                                                                                                                                                                      0x7ffff7304bc3 
    29 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                 0x7ffff72a3b9c 
    30 QApplication::notify(QObject *, QEvent *)                                                                                                                               0x7ffff72a7f00 
    31 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                  0x7ffff6ca6b80 
    32 QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *)                                                                                0x7ffff59daaa9 
    33 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *)                                                                    0x7ffff59db63d 
    34 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                   0x7ffff59bcb23 
    35 ??                                                                                                                                                                      0x7fffee2f1550 
    36 g_main_context_dispatch                                                                                                                                                 0x7ffff45001a7 
    37 ??                                                                                                                                                                      0x7ffff4500400 
    38 g_main_context_iteration                                                                                                                                                0x7ffff45004ac 
    39 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                              0x7ffff6cf6177 
    40 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                 0x7ffff6ca4bca 
    41 QCoreApplication::exec()                                                                                                                                                0x7ffff6caca5d 
    42 main                                                                                                                                                        main.cpp 15 0x400cff       
    
    E jsulmJ 2 Replies Last reply
    0
    • mstothM mstoth

      I have a problem which appears apparently randomly which is a SIGSEGV but the stack trace only has main() as a viewable level.

      The levels below main() of the stack are all grey and seem to terminate in a call to getenv. It happens when I make a change to my code and the change can be almost anything! I have to save my work after each small step just to make sure I don't have to back-track too far.
      There is a long list of function calls which are greyed out above the main() listing. The last call is to __GI_getenv(). When I run the code in gdb instead of the Qt environment, I see a stack trace with the following message

      Thread 1 "GenisysVoicesPa" received signal SIGSEGV, Segmentation fault.
      __GI_getenv (name=0x7fffee365b47 "_NO_FT_CACHE") at getenv.c:84
      84 getenv.c: No such file or directory.
      (gdb)

      On another occasion the string passed was "US_REGION" neither of these strings are in my code.
      I have no idea why this segmentation violation pops up and it seems to happen randomly in the course of my work.

      Sometimes if I go to a previous version that worked, and I return to the new version that didn't, the new version starts to work! So that seems to imply an environment issue but I'm not changing anything (that I know of) in my environment. If I had hair I'd be pulling it out!
      Can anyone help? please!
      Thank you,
      Michael Toth

      Here is the complete stack trace. The only line that is not grey is main().

      1  __GI_getenv                                                                                                                                                 getenv.c 84 0x7ffff611180d 
      2  qgetenv(const char *)                                                                                                                                                   0x7ffff6ac7121 
      3  QFontEngineFT::QFontEngineFT(QFontDef const&)                                                                                                                           0x7fffee329e78 
      4  ??                                                                                                                                                                      0x7fffee2f327c 
      5  ??                                                                                                                                                                      0x7ffff5ad6eec 
      6  QFontDatabase::findFont(QFontDef const&, int)                                                                                                                           0x7ffff5ad7524 
      7  QFontDatabase::load(QFontPrivate const *, int)                                                                                                                          0x7ffff5ad807d 
      8  QFontPrivate::engineForScript(int) const                                                                                                                                0x7ffff5aaf7f3 
      9  QFontMetricsF::leading() const                                                                                                                                          0x7ffff5acc621 
      10 ??                                                                                                                                                                      0x7ffff5c55af3 
      11 QPainter::drawText(QRect const&, int, QString const&, QRect *)                                                                                                          0x7ffff5c5c774 
      12 QStyle::drawItemText(QPainter *, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const                                                   0x7ffff730e9b7 
      13 QLabel::paintEvent(QPaintEvent *)                                                                                                                                       0x7ffff73ea458 
      14 QWidget::event(QEvent *)                                                                                                                                                0x7ffff72e6bd8 
      15 QFrame::event(QEvent *)                                                                                                                                                 0x7ffff73e3b9e 
      16 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                 0x7ffff72a3b9c 
      17 QApplication::notify(QObject *, QEvent *)                                                                                                                               0x7ffff72a7f00 
      18 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                  0x7ffff6ca6b80 
      19 QWidgetPrivate::sendPaintEvent(QRegion const&)                                                                                                                          0x7ffff72dfefa 
      20 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)                                                       0x7ffff72e050f 
      21 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e1274 
      22 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
      23 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
      24 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
      25 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)                                                       0x7ffff72e00b2 
      26 ??                                                                                                                                                                      0x7ffff72b09aa 
      27 ??                                                                                                                                                                      0x7ffff72b1085 
      28 ??                                                                                                                                                                      0x7ffff7304bc3 
      29 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                 0x7ffff72a3b9c 
      30 QApplication::notify(QObject *, QEvent *)                                                                                                                               0x7ffff72a7f00 
      31 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                  0x7ffff6ca6b80 
      32 QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *)                                                                                0x7ffff59daaa9 
      33 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *)                                                                    0x7ffff59db63d 
      34 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                   0x7ffff59bcb23 
      35 ??                                                                                                                                                                      0x7fffee2f1550 
      36 g_main_context_dispatch                                                                                                                                                 0x7ffff45001a7 
      37 ??                                                                                                                                                                      0x7ffff4500400 
      38 g_main_context_iteration                                                                                                                                                0x7ffff45004ac 
      39 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                              0x7ffff6cf6177 
      40 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                 0x7ffff6ca4bca 
      41 QCoreApplication::exec()                                                                                                                                                0x7ffff6caca5d 
      42 main                                                                                                                                                        main.cpp 15 0x400cff       
      
      E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      @mstoth You most probably have a memory handling problem, like trying to read something through a null pointer. Can you run your program through an analysis tool like Valgrind memory error detector?

      1 Reply Last reply
      0
      • mstothM mstoth

        I have a problem which appears apparently randomly which is a SIGSEGV but the stack trace only has main() as a viewable level.

        The levels below main() of the stack are all grey and seem to terminate in a call to getenv. It happens when I make a change to my code and the change can be almost anything! I have to save my work after each small step just to make sure I don't have to back-track too far.
        There is a long list of function calls which are greyed out above the main() listing. The last call is to __GI_getenv(). When I run the code in gdb instead of the Qt environment, I see a stack trace with the following message

        Thread 1 "GenisysVoicesPa" received signal SIGSEGV, Segmentation fault.
        __GI_getenv (name=0x7fffee365b47 "_NO_FT_CACHE") at getenv.c:84
        84 getenv.c: No such file or directory.
        (gdb)

        On another occasion the string passed was "US_REGION" neither of these strings are in my code.
        I have no idea why this segmentation violation pops up and it seems to happen randomly in the course of my work.

        Sometimes if I go to a previous version that worked, and I return to the new version that didn't, the new version starts to work! So that seems to imply an environment issue but I'm not changing anything (that I know of) in my environment. If I had hair I'd be pulling it out!
        Can anyone help? please!
        Thank you,
        Michael Toth

        Here is the complete stack trace. The only line that is not grey is main().

        1  __GI_getenv                                                                                                                                                 getenv.c 84 0x7ffff611180d 
        2  qgetenv(const char *)                                                                                                                                                   0x7ffff6ac7121 
        3  QFontEngineFT::QFontEngineFT(QFontDef const&)                                                                                                                           0x7fffee329e78 
        4  ??                                                                                                                                                                      0x7fffee2f327c 
        5  ??                                                                                                                                                                      0x7ffff5ad6eec 
        6  QFontDatabase::findFont(QFontDef const&, int)                                                                                                                           0x7ffff5ad7524 
        7  QFontDatabase::load(QFontPrivate const *, int)                                                                                                                          0x7ffff5ad807d 
        8  QFontPrivate::engineForScript(int) const                                                                                                                                0x7ffff5aaf7f3 
        9  QFontMetricsF::leading() const                                                                                                                                          0x7ffff5acc621 
        10 ??                                                                                                                                                                      0x7ffff5c55af3 
        11 QPainter::drawText(QRect const&, int, QString const&, QRect *)                                                                                                          0x7ffff5c5c774 
        12 QStyle::drawItemText(QPainter *, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const                                                   0x7ffff730e9b7 
        13 QLabel::paintEvent(QPaintEvent *)                                                                                                                                       0x7ffff73ea458 
        14 QWidget::event(QEvent *)                                                                                                                                                0x7ffff72e6bd8 
        15 QFrame::event(QEvent *)                                                                                                                                                 0x7ffff73e3b9e 
        16 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                 0x7ffff72a3b9c 
        17 QApplication::notify(QObject *, QEvent *)                                                                                                                               0x7ffff72a7f00 
        18 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                  0x7ffff6ca6b80 
        19 QWidgetPrivate::sendPaintEvent(QRegion const&)                                                                                                                          0x7ffff72dfefa 
        20 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)                                                       0x7ffff72e050f 
        21 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e1274 
        22 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
        23 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
        24 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)             0x7ffff72e10ca 
        25 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, int, QPainter *, QWidgetBackingStore *)                                                       0x7ffff72e00b2 
        26 ??                                                                                                                                                                      0x7ffff72b09aa 
        27 ??                                                                                                                                                                      0x7ffff72b1085 
        28 ??                                                                                                                                                                      0x7ffff7304bc3 
        29 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                 0x7ffff72a3b9c 
        30 QApplication::notify(QObject *, QEvent *)                                                                                                                               0x7ffff72a7f00 
        31 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                  0x7ffff6ca6b80 
        32 QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *)                                                                                0x7ffff59daaa9 
        33 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *)                                                                    0x7ffff59db63d 
        34 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                   0x7ffff59bcb23 
        35 ??                                                                                                                                                                      0x7fffee2f1550 
        36 g_main_context_dispatch                                                                                                                                                 0x7ffff45001a7 
        37 ??                                                                                                                                                                      0x7ffff4500400 
        38 g_main_context_iteration                                                                                                                                                0x7ffff45004ac 
        39 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                              0x7ffff6cf6177 
        40 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                 0x7ffff6ca4bca 
        41 QCoreApplication::exec()                                                                                                                                                0x7ffff6caca5d 
        42 main                                                                                                                                                        main.cpp 15 0x400cff       
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @mstoth What are the Qt version, compiler and OS?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • mstothM Offline
          mstothM Offline
          mstoth
          wrote on last edited by mstoth
          #4

          Qt Creator 4.0.3
          Based on Qt 5.7.0 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit)
          Built on Jul 5 2016 01:05:50
          From revision ce4ddcb060
          Running on Ubuntu 16.04

          Running Valgrind produces the following output

          //==3200== Invalid read of size 2
          ==3200==    at 0x67AF80D: getenv (getenv.c:84)
          ==3200==    by 0x5B58120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
          ==3200==    by 0xEB50E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
          ==3200==    by 0xEB1A27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
          ==3200==    by 0x6D35EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6D36523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6D3707C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6D0E7F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6D2B620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6EB4AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6EBB773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x54149B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
          ==3200==  Address 0x1 is not stack'd, malloc'd or (recently) free'd
          ==3200== 
          ==3200== 
          ==3200== Process terminating with default action of signal 11 (SIGSEGV)
          ==3200==  Access not within mapped region at address 0x1
          ==3200==    at 0x67AF80D: getenv (getenv.c:84)
          ==3200==    by 0x5B58120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
          ==3200==    by 0xEB50E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
          ==3200==    by 0xEB1A27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
          ==3200==    by 0x6D35EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6D36523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6D3707C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6D0E7F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6D2B620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6EB4AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x6EBB773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
          ==3200==    by 0x54149B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
          ==3200==  If you believe this happened as a result of a stack
          ==3200==  overflow in your program's main thread (unlikely but
          ==3200==  possible), you can try to increase the size of the
          ==3200==  main thread stack using the --main-stacksize= flag.
          ==3200==  The main thread stack size used in this run was 8388608.
          ==3200== 
          ==3200== HEAP SUMMARY:
          ==3200==     in use at exit: 4,544,622 bytes in 35,589 blocks
          ==3200==   total heap usage: 147,414 allocs, 111,825 frees, 22,561,733 bytes allocated
          ==3200== 
          ==3200== LEAK SUMMARY:
          ==3200==    definitely lost: 2,864 bytes in 11 blocks
          ==3200==    indirectly lost: 13,203 bytes in 557 blocks
          ==3200==      possibly lost: 16,500 bytes in 206 blocks
          ==3200==    still reachable: 4,191,055 bytes in 33,309 blocks
          ==3200==                       of which reachable via heuristic:
          ==3200==                         length64           : 7,880 bytes in 116 blocks
          ==3200==                         newarray           : 2,112 bytes in 52 blocks
          ==3200==                         multipleinheritance: 304 bytes in 2 blocks
          ==3200==         suppressed: 0 bytes in 0 blocks
          ==3200== Rerun with --leak-check=full to see details of leaked memory
          ==3200== 
          ==3200== For counts of detected and suppressed errors, rerun with: -v
          ==3200== Use --track-origins=yes to see where uninitialised values come from
          ==3200== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
          Segmentation fault (core dumped)
          

          And earlier there was several mentions of conditional jumps based on uninitialized values

          //==3200== Memcheck, a memory error detector
          ==3200== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
          ==3200== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
          ==3200== Command: ./GenisysVoicesPanel
          ==3200== 
          ==3200== Conditional jump or move depends on uninitialised value(s)
          ==3200==    at 0x1269D13D: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x7E031D3: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E1D9A5: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E1E554: g_signal_emit_by_name (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E0A8F7: g_object_set_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E0AFCB: g_object_set (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x548C7A5: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
          ==3200==    by 0x5415D2C: QStyleFactory::create(QString const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
          ==3200==    by 0x53AB363: QApplication::style() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
          ==3200==    by 0x53AB5C4: QApplicationPrivate::initialize() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
          ==3200==    by 0x53AB613: QApplicationPrivate::init() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
          ==3200==    by 0x400CDC: main (main.cpp:12)
          ==3200== 
          ==3200== Conditional jump or move depends on uninitialised value(s)
          ==3200==    at 0x84C93F8: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
          ==3200==    by 0x126A0734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x126A0D38: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x126A106E: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x7E02FA4: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E14AFB: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E1DD5B: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E1E08E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x1282FB53: gtk_widget_realize (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x12830E67: gtk_widget_set_parent (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x126CFA32: gtk_fixed_put (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x7E060A6: g_cclosure_marshal_VOID__OBJECTv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200== 
          ==3200== Conditional jump or move depends on uninitialised value(s)
          ==3200==    at 0x84C9425: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
          ==3200==    by 0x126A0734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x126A0D38: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x126A106E: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x7E02FA4: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E14AFB: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E1DD5B: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x7E1E08E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200==    by 0x1282FB53: gtk_widget_realize (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x12830E67: gtk_widget_set_parent (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x126CFA32: gtk_fixed_put (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
          ==3200==    by 0x7E060A6: g_cclosure_marshal_VOID__OBJECTv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
          ==3200== 
          

          However going from this information to the source of the problem is still a mystery to me.
          None of the references seem to indicate particular places in my code.
          Any ideas?

          A 1 Reply Last reply
          0
          • mstothM mstoth

            Qt Creator 4.0.3
            Based on Qt 5.7.0 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit)
            Built on Jul 5 2016 01:05:50
            From revision ce4ddcb060
            Running on Ubuntu 16.04

            Running Valgrind produces the following output

            //==3200== Invalid read of size 2
            ==3200==    at 0x67AF80D: getenv (getenv.c:84)
            ==3200==    by 0x5B58120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
            ==3200==    by 0xEB50E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
            ==3200==    by 0xEB1A27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
            ==3200==    by 0x6D35EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6D36523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6D3707C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6D0E7F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6D2B620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6EB4AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6EBB773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x54149B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
            ==3200==  Address 0x1 is not stack'd, malloc'd or (recently) free'd
            ==3200== 
            ==3200== 
            ==3200== Process terminating with default action of signal 11 (SIGSEGV)
            ==3200==  Access not within mapped region at address 0x1
            ==3200==    at 0x67AF80D: getenv (getenv.c:84)
            ==3200==    by 0x5B58120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
            ==3200==    by 0xEB50E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
            ==3200==    by 0xEB1A27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
            ==3200==    by 0x6D35EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6D36523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6D3707C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6D0E7F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6D2B620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6EB4AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x6EBB773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
            ==3200==    by 0x54149B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
            ==3200==  If you believe this happened as a result of a stack
            ==3200==  overflow in your program's main thread (unlikely but
            ==3200==  possible), you can try to increase the size of the
            ==3200==  main thread stack using the --main-stacksize= flag.
            ==3200==  The main thread stack size used in this run was 8388608.
            ==3200== 
            ==3200== HEAP SUMMARY:
            ==3200==     in use at exit: 4,544,622 bytes in 35,589 blocks
            ==3200==   total heap usage: 147,414 allocs, 111,825 frees, 22,561,733 bytes allocated
            ==3200== 
            ==3200== LEAK SUMMARY:
            ==3200==    definitely lost: 2,864 bytes in 11 blocks
            ==3200==    indirectly lost: 13,203 bytes in 557 blocks
            ==3200==      possibly lost: 16,500 bytes in 206 blocks
            ==3200==    still reachable: 4,191,055 bytes in 33,309 blocks
            ==3200==                       of which reachable via heuristic:
            ==3200==                         length64           : 7,880 bytes in 116 blocks
            ==3200==                         newarray           : 2,112 bytes in 52 blocks
            ==3200==                         multipleinheritance: 304 bytes in 2 blocks
            ==3200==         suppressed: 0 bytes in 0 blocks
            ==3200== Rerun with --leak-check=full to see details of leaked memory
            ==3200== 
            ==3200== For counts of detected and suppressed errors, rerun with: -v
            ==3200== Use --track-origins=yes to see where uninitialised values come from
            ==3200== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
            Segmentation fault (core dumped)
            

            And earlier there was several mentions of conditional jumps based on uninitialized values

            //==3200== Memcheck, a memory error detector
            ==3200== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
            ==3200== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
            ==3200== Command: ./GenisysVoicesPanel
            ==3200== 
            ==3200== Conditional jump or move depends on uninitialised value(s)
            ==3200==    at 0x1269D13D: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x7E031D3: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E1D9A5: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E1E554: g_signal_emit_by_name (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E0A8F7: g_object_set_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E0AFCB: g_object_set (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x548C7A5: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
            ==3200==    by 0x5415D2C: QStyleFactory::create(QString const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
            ==3200==    by 0x53AB363: QApplication::style() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
            ==3200==    by 0x53AB5C4: QApplicationPrivate::initialize() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
            ==3200==    by 0x53AB613: QApplicationPrivate::init() (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
            ==3200==    by 0x400CDC: main (main.cpp:12)
            ==3200== 
            ==3200== Conditional jump or move depends on uninitialised value(s)
            ==3200==    at 0x84C93F8: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
            ==3200==    by 0x126A0734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x126A0D38: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x126A106E: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x7E02FA4: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E14AFB: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E1DD5B: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E1E08E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x1282FB53: gtk_widget_realize (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x12830E67: gtk_widget_set_parent (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x126CFA32: gtk_fixed_put (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x7E060A6: g_cclosure_marshal_VOID__OBJECTv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200== 
            ==3200== Conditional jump or move depends on uninitialised value(s)
            ==3200==    at 0x84C9425: g_utf8_offset_to_pointer (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.1)
            ==3200==    by 0x126A0734: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x126A0D38: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x126A106E: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x7E02FA4: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E14AFB: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E1DD5B: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x7E1E08E: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200==    by 0x1282FB53: gtk_widget_realize (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x12830E67: gtk_widget_set_parent (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x126CFA32: gtk_fixed_put (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30)
            ==3200==    by 0x7E060A6: g_cclosure_marshal_VOID__OBJECTv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.1)
            ==3200== 
            

            However going from this information to the source of the problem is still a mystery to me.
            None of the references seem to indicate particular places in my code.
            Any ideas?

            A Offline
            A Offline
            ambershark
            wrote on last edited by
            #5

            @mstoth It looks, based on that valgrind, that you are cleaning up an object with messages still in the queue.

            Do you ever delete a QWidget of yours explicitly? If so try using widget->deleteLater() instead.

            The memory has definitely been deleted, hence the crash. It's almost assuredly in your code somewhere and has nothing to do with getenv from what I can tell.

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            mstothM A 2 Replies Last reply
            1
            • A ambershark

              @mstoth It looks, based on that valgrind, that you are cleaning up an object with messages still in the queue.

              Do you ever delete a QWidget of yours explicitly? If so try using widget->deleteLater() instead.

              The memory has definitely been deleted, hence the crash. It's almost assuredly in your code somewhere and has nothing to do with getenv from what I can tell.

              mstothM Offline
              mstothM Offline
              mstoth
              wrote on last edited by
              #6

              @ambershark The only object I am deleting is the ui object in the destructors. Do you see anything that indicates what object is being deleted? I can't tell how you know based on the valgrind that i am cleaning up an object with messages still in the queue. Can you tell me how you see that?

              1 Reply Last reply
              0
              • A ambershark

                @mstoth It looks, based on that valgrind, that you are cleaning up an object with messages still in the queue.

                Do you ever delete a QWidget of yours explicitly? If so try using widget->deleteLater() instead.

                The memory has definitely been deleted, hence the crash. It's almost assuredly in your code somewhere and has nothing to do with getenv from what I can tell.

                A Offline
                A Offline
                ambershark
                wrote on last edited by ambershark
                #7

                @ambershark It's a guess based on this line right here:

                Address 0x1 is not stack'd, malloc'd or (recently) free'd

                The usual culprit in cases like this is a cleaned up QWidget that was still in use. Sometimes it feels like deleting a widget at a certain point is ok and it won't get used again but a lot of times that widget still has messages in the event queue. When those messages get processed the object is no longer valid and causes these types of issues. This is why

                So valgrind itself isn't telling me that but with the object that was deleted coupled with many years of experience in Qt, I guessed that may be the issue. I would need a lot more information (and code) to be able to find the actual problem, but tried to guide you with the information you posted.

                Another problem you may be experiencing based on the info you provided is an unclean build. Does this project use any so's that you build as part of your build step? Sometimes when you have a bad build you will see weird crashes like this and when you say you have to save after each small step that leads me to think you may have issues with reusing already compiled objects.

                Oh you can also try actually stepping through it with a debugger while it's running and check the object in question yourself. I'm pretty sure you will find it's memory has been deleted/corrupted.

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                1 Reply Last reply
                1
                • mstothM Offline
                  mstothM Offline
                  mstoth
                  wrote on last edited by
                  #8

                  Thank you for your help. I'll keep working on this and hopefully get to the root cause.

                  A 1 Reply Last reply
                  0
                  • mstothM mstoth

                    Thank you for your help. I'll keep working on this and hopefully get to the root cause.

                    A Offline
                    A Offline
                    ambershark
                    wrote on last edited by
                    #9

                    @mstoth Good luck! If you get more information I'd be happy to try and help solve it.

                    Also, have you tried it on any other systems? Something besides Ubuntu? Sometimes Ubuntu does funny things compared to other linux distros. Maybe there is an issue with the system fonts that could be causing it.

                    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                    1 Reply Last reply
                    0
                    • mstothM Offline
                      mstothM Offline
                      mstoth
                      wrote on last edited by
                      #10

                      I am unable to use a different system. Unfortunately we are committed to using ubuntu for now. I have done several cleans and rebuilds. I do wonder about the comment regarding fonts since I see some mention of fonts in the stack trace. If it is a font problem, what can be done about that? I'm out of my depth here and my productivity is dropping due to excessive rebuilds and finger crossings. Sometimes it works and sometimes not (still). It does seem to work properly on the embedded device we are using (BeagleBone Black). I never have a problem running on our BeagleBone even if it fails on the desktop.
                      If I try to use the debugger I get left in assembly code since none of my code is in the stack trace. Just awful. Any more suggestions from anyone would be greatly appreciated.

                      J.HilkJ 1 Reply Last reply
                      0
                      • mstothM mstoth

                        I am unable to use a different system. Unfortunately we are committed to using ubuntu for now. I have done several cleans and rebuilds. I do wonder about the comment regarding fonts since I see some mention of fonts in the stack trace. If it is a font problem, what can be done about that? I'm out of my depth here and my productivity is dropping due to excessive rebuilds and finger crossings. Sometimes it works and sometimes not (still). It does seem to work properly on the embedded device we are using (BeagleBone Black). I never have a problem running on our BeagleBone even if it fails on the desktop.
                        If I try to use the debugger I get left in assembly code since none of my code is in the stack trace. Just awful. Any more suggestions from anyone would be greatly appreciated.

                        J.HilkJ Offline
                        J.HilkJ Offline
                        J.Hilk
                        Moderators
                        wrote on last edited by
                        #11

                        @mstoth
                        I have at least a suggestion.

                        I run into something similar recently. After a while, I packed my project from my windows pc over to my Mac, and gave it a clean build with clanq. A got about 100 compiler warnings that I fixed => Haven't run into a the problem since then, either on Windows or Mac.


                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                        Q: What's that?
                        A: It's blue light.
                        Q: What does it do?
                        A: It turns blue.

                        1 Reply Last reply
                        0
                        • mstothM Offline
                          mstothM Offline
                          mstoth
                          wrote on last edited by
                          #12

                          Thanks! I'll try the Mac environment and see if that will help.

                          A 1 Reply Last reply
                          0
                          • mstothM mstoth

                            Thanks! I'll try the Mac environment and see if that will help.

                            A Offline
                            A Offline
                            ambershark
                            wrote on last edited by ambershark
                            #13

                            @mstoth Another idea since it is crashing in qgetenv... are you perchance multithreaded? Calls to the environment via getenv are not thread safe. So if somehow it is calling getenv in multiple threads that is why you will see the crash only occasionally.

                            And on the beaglebone it would be less likely to appear (in your case never) because the timing is so different compared to your desktop processor. The problem would still be there it just wouldn't show up as much.

                            When I was younger multi core cpus were not a thing, and running dual cpus was quite expensive. I remember building a multi cpu system just to test threading issues like this since it would change the timing and almost always crash if you had an issue like this.

                            Also, don't forget that valgrind is finding legitimate memory issues in your application. This means you definitely have a bug in there somewhere. It will be related to memory that is freed and then used. So look for dangling pointers.

                            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                            1 Reply Last reply
                            3
                            • mstothM Offline
                              mstothM Offline
                              mstoth
                              wrote on last edited by mstoth
                              #14

                              I am not manually starting separate threads but it was my understanding that the application is multi-threaded due to the nature of the slots and signals. I emit a signal every time the system receives a message on a tcp socket. Each signal is matched with a slot in one or more objects. I assume that while one signal is being processed, it's possible to emit another one if a message comes into the socket while the first signal is being handled. When I get the crash, the Threads menu shows 12 threads; GenisysVoicesPanel (my app), QXcbEventReader, dconf worker, gmain, gdbus, QDBusConnection, pool, llvmpipe-0, llvmpipe-1, llvmpipe-2, llvmpipe-3.

                              I believe you are correct when you say there is a bug in my code but valgrind is not helping me too much. How can you trace the problem when valgrind (and the stack trace) shows nothing related to your code? Here's an example of what I mean. The output of valgrind says:

                              ==9773== Invalid read of size 2
                              ==9773==    at 0x67C180D: getenv (getenv.c:84)
                              ==9773==    by 0x5B6A120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
                              ==9773==    by 0xEB62E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                              ==9773==    by 0xEB2C27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                              ==9773==    by 0x6D47EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6D48523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6D4907C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6D207F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6D3D620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6EC6AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6ECD773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x54269B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
                              ==9773==  Address 0x2 is not stack'd, malloc'd or (recently) free'd
                              ==9773== 
                              ==9773== 
                              ==9773== Process terminating with default action of signal 11 (SIGSEGV)
                              ==9773==  Access not within mapped region at address 0x2
                              ==9773==    at 0x67C180D: getenv (getenv.c:84)
                              ==9773==    by 0x5B6A120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
                              ==9773==    by 0xEB62E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                              ==9773==    by 0xEB2C27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                              ==9773==    by 0x6D47EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6D48523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6D4907C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6D207F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6D3D620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6EC6AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x6ECD773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                              ==9773==    by 0x54269B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
                              ==9773==  If you believe this happened as a result of a stack
                              ==9773==  overflow in your program's main thread (unlikely but
                              ==9773==  possible), you can try to increase the size of the
                              ==9773==  main thread stack using the --main-stacksize= flag.
                              ==9773==  The main thread stack size used in this run was 8388608.
                              ==9773== 
                              ==9773== HEAP SUMMARY:
                              ==9773==     in use at exit: 4,317,169 bytes in 34,765 blocks
                              ==9773==   total heap usage: 139,400 allocs, 104,635 frees, 21,351,017 bytes allocated
                              ==9773== 
                              ==9773== LEAK SUMMARY:
                              ==9773==    definitely lost: 2,864 bytes in 11 blocks
                              ==9773==    indirectly lost: 13,196 bytes in 556 blocks
                              ==9773==      possibly lost: 16,507 bytes in 207 blocks
                              ==9773==    still reachable: 3,962,882 bytes in 32,477 blocks
                              ==9773==                       of which reachable via heuristic:
                              ==9773==                         length64           : 7,880 bytes in 116 blocks
                              ==9773==                         newarray           : 2,112 bytes in 52 blocks
                              ==9773==                         multipleinheritance: 152 bytes in 1 blocks
                              ==9773==         suppressed: 0 bytes in 0 blocks
                              ==9773== Rerun with --leak-check=full to see details of leaked memory
                              ==9773== 
                              ==9773== For counts of detected and suppressed errors, rerun with: -v
                              ==9773== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
                              
                              

                              So from what I can tell, it all seems to start with QStyle::drawItemText() and I assume that must have something to do with a panel being drawn. There doesn't seem to be any information that points to where in my code it is happening however. I checked the panel I suspect (although it happens also randomly after this panel is displayed) and the fonts are all SansSerif so there is nothing unusual about the fonts that I can tell.

                              How can I learn from the valgrind information about where in my code the problem occurs? My ignorance is really a frustration! Thanks for your advice!

                              kshegunovK A 2 Replies Last reply
                              0
                              • mstothM mstoth

                                I am not manually starting separate threads but it was my understanding that the application is multi-threaded due to the nature of the slots and signals. I emit a signal every time the system receives a message on a tcp socket. Each signal is matched with a slot in one or more objects. I assume that while one signal is being processed, it's possible to emit another one if a message comes into the socket while the first signal is being handled. When I get the crash, the Threads menu shows 12 threads; GenisysVoicesPanel (my app), QXcbEventReader, dconf worker, gmain, gdbus, QDBusConnection, pool, llvmpipe-0, llvmpipe-1, llvmpipe-2, llvmpipe-3.

                                I believe you are correct when you say there is a bug in my code but valgrind is not helping me too much. How can you trace the problem when valgrind (and the stack trace) shows nothing related to your code? Here's an example of what I mean. The output of valgrind says:

                                ==9773== Invalid read of size 2
                                ==9773==    at 0x67C180D: getenv (getenv.c:84)
                                ==9773==    by 0x5B6A120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
                                ==9773==    by 0xEB62E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                                ==9773==    by 0xEB2C27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                                ==9773==    by 0x6D47EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6D48523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6D4907C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6D207F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6D3D620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6EC6AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6ECD773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x54269B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
                                ==9773==  Address 0x2 is not stack'd, malloc'd or (recently) free'd
                                ==9773== 
                                ==9773== 
                                ==9773== Process terminating with default action of signal 11 (SIGSEGV)
                                ==9773==  Access not within mapped region at address 0x2
                                ==9773==    at 0x67C180D: getenv (getenv.c:84)
                                ==9773==    by 0x5B6A120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
                                ==9773==    by 0xEB62E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                                ==9773==    by 0xEB2C27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                                ==9773==    by 0x6D47EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6D48523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6D4907C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6D207F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6D3D620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6EC6AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x6ECD773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                ==9773==    by 0x54269B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
                                ==9773==  If you believe this happened as a result of a stack
                                ==9773==  overflow in your program's main thread (unlikely but
                                ==9773==  possible), you can try to increase the size of the
                                ==9773==  main thread stack using the --main-stacksize= flag.
                                ==9773==  The main thread stack size used in this run was 8388608.
                                ==9773== 
                                ==9773== HEAP SUMMARY:
                                ==9773==     in use at exit: 4,317,169 bytes in 34,765 blocks
                                ==9773==   total heap usage: 139,400 allocs, 104,635 frees, 21,351,017 bytes allocated
                                ==9773== 
                                ==9773== LEAK SUMMARY:
                                ==9773==    definitely lost: 2,864 bytes in 11 blocks
                                ==9773==    indirectly lost: 13,196 bytes in 556 blocks
                                ==9773==      possibly lost: 16,507 bytes in 207 blocks
                                ==9773==    still reachable: 3,962,882 bytes in 32,477 blocks
                                ==9773==                       of which reachable via heuristic:
                                ==9773==                         length64           : 7,880 bytes in 116 blocks
                                ==9773==                         newarray           : 2,112 bytes in 52 blocks
                                ==9773==                         multipleinheritance: 152 bytes in 1 blocks
                                ==9773==         suppressed: 0 bytes in 0 blocks
                                ==9773== Rerun with --leak-check=full to see details of leaked memory
                                ==9773== 
                                ==9773== For counts of detected and suppressed errors, rerun with: -v
                                ==9773== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
                                
                                

                                So from what I can tell, it all seems to start with QStyle::drawItemText() and I assume that must have something to do with a panel being drawn. There doesn't seem to be any information that points to where in my code it is happening however. I checked the panel I suspect (although it happens also randomly after this panel is displayed) and the fonts are all SansSerif so there is nothing unusual about the fonts that I can tell.

                                How can I learn from the valgrind information about where in my code the problem occurs? My ignorance is really a frustration! Thanks for your advice!

                                kshegunovK Offline
                                kshegunovK Offline
                                kshegunov
                                Moderators
                                wrote on last edited by
                                #15

                                Try breaking at the segfault and see which widget's being painted as #25 QWidgetPrivate::drawWidget or try to trace which is the object receiving the event (#30 QApplication::notify ) - basically walk down the backtrace; the debugger should provide you with the locals and with some digging you should be able to find the culprit. Also you may consider GammaRay to try and see which widget is triggering the problem (apparently it's an expose event).

                                Btw, you seem to have some holes in that backtrace ...?

                                Read and abide by the Qt Code of Conduct

                                1 Reply Last reply
                                1
                                • mstothM mstoth

                                  I am not manually starting separate threads but it was my understanding that the application is multi-threaded due to the nature of the slots and signals. I emit a signal every time the system receives a message on a tcp socket. Each signal is matched with a slot in one or more objects. I assume that while one signal is being processed, it's possible to emit another one if a message comes into the socket while the first signal is being handled. When I get the crash, the Threads menu shows 12 threads; GenisysVoicesPanel (my app), QXcbEventReader, dconf worker, gmain, gdbus, QDBusConnection, pool, llvmpipe-0, llvmpipe-1, llvmpipe-2, llvmpipe-3.

                                  I believe you are correct when you say there is a bug in my code but valgrind is not helping me too much. How can you trace the problem when valgrind (and the stack trace) shows nothing related to your code? Here's an example of what I mean. The output of valgrind says:

                                  ==9773== Invalid read of size 2
                                  ==9773==    at 0x67C180D: getenv (getenv.c:84)
                                  ==9773==    by 0x5B6A120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
                                  ==9773==    by 0xEB62E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                                  ==9773==    by 0xEB2C27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                                  ==9773==    by 0x6D47EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6D48523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6D4907C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6D207F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6D3D620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6EC6AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6ECD773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x54269B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
                                  ==9773==  Address 0x2 is not stack'd, malloc'd or (recently) free'd
                                  ==9773== 
                                  ==9773== 
                                  ==9773== Process terminating with default action of signal 11 (SIGSEGV)
                                  ==9773==  Access not within mapped region at address 0x2
                                  ==9773==    at 0x67C180D: getenv (getenv.c:84)
                                  ==9773==    by 0x5B6A120: qgetenv(char const*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Core.so.5.6.1)
                                  ==9773==    by 0xEB62E77: QFontEngineFT::QFontEngineFT(QFontDef const&) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                                  ==9773==    by 0xEB2C27B: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5XcbQpa.so.5.6.1)
                                  ==9773==    by 0x6D47EEB: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6D48523: QFontDatabase::findFont(QFontDef const&, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6D4907C: QFontDatabase::load(QFontPrivate const*, int) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6D207F2: QFontPrivate::engineForScript(int) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6D3D620: QFontMetricsF::leading() const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6EC6AF2: ??? (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x6ECD773: QPainter::drawText(QRect const&, int, QString const&, QRect*) (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Gui.so.5.6.1)
                                  ==9773==    by 0x54269B6: QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const (in /home/bbb_developer/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5.6.1)
                                  ==9773==  If you believe this happened as a result of a stack
                                  ==9773==  overflow in your program's main thread (unlikely but
                                  ==9773==  possible), you can try to increase the size of the
                                  ==9773==  main thread stack using the --main-stacksize= flag.
                                  ==9773==  The main thread stack size used in this run was 8388608.
                                  ==9773== 
                                  ==9773== HEAP SUMMARY:
                                  ==9773==     in use at exit: 4,317,169 bytes in 34,765 blocks
                                  ==9773==   total heap usage: 139,400 allocs, 104,635 frees, 21,351,017 bytes allocated
                                  ==9773== 
                                  ==9773== LEAK SUMMARY:
                                  ==9773==    definitely lost: 2,864 bytes in 11 blocks
                                  ==9773==    indirectly lost: 13,196 bytes in 556 blocks
                                  ==9773==      possibly lost: 16,507 bytes in 207 blocks
                                  ==9773==    still reachable: 3,962,882 bytes in 32,477 blocks
                                  ==9773==                       of which reachable via heuristic:
                                  ==9773==                         length64           : 7,880 bytes in 116 blocks
                                  ==9773==                         newarray           : 2,112 bytes in 52 blocks
                                  ==9773==                         multipleinheritance: 152 bytes in 1 blocks
                                  ==9773==         suppressed: 0 bytes in 0 blocks
                                  ==9773== Rerun with --leak-check=full to see details of leaked memory
                                  ==9773== 
                                  ==9773== For counts of detected and suppressed errors, rerun with: -v
                                  ==9773== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
                                  
                                  

                                  So from what I can tell, it all seems to start with QStyle::drawItemText() and I assume that must have something to do with a panel being drawn. There doesn't seem to be any information that points to where in my code it is happening however. I checked the panel I suspect (although it happens also randomly after this panel is displayed) and the fonts are all SansSerif so there is nothing unusual about the fonts that I can tell.

                                  How can I learn from the valgrind information about where in my code the problem occurs? My ignorance is really a frustration! Thanks for your advice!

                                  A Offline
                                  A Offline
                                  ambershark
                                  wrote on last edited by
                                  #16

                                  @mstoth Signals/slots are not multithreaded by default. The QEventLoop is on a single thread and you can definitely starve it if you are doing things and don't give it a chance to process events.

                                  If you are doing tcp/ip stuff I would recommend moving that to it's own thread. But that isn't the point of this thread, just wanted to let you know you may starve your event loop and freeze up your gui with a long tcpip delay. :)

                                  As for your problem, yea valgrind's info isn't helping that much. It goes back to my first post on this thread. I think you are deleting a widget (inadvertently) while it still has events on the queue. I feel even stronger about this with your recent statements about signals/slots. Since you thought they were multithreaded that would lead me to believe even more that at some point you deleted something and once your stack bubbled back up to the event loop it tried to process a message on a deleted QWidget.

                                  It's hard enough to find a bug like this when you have the source code, it is extremely difficult in a setting like this where we can't see any code. :/ All I can do is try to guide you based on what I've seen in the past based on my experience.

                                  I would look for anywhere you delete widgets, either explicitly, i.e. delete myWidget, or indirectly. Indirect examples would be widgets on the stack, widgets that have been reparented to other widgets you may delete, etc. Calls to deleteLater() should be ok though as they won't clean up until all events are dealt with. Also don't forget any smart pointers you may use. If they reach a 0 ref count for some reason they will auto delete. C++ smart pointers and Qt's smart pointers could both be the culprits here if you use them.

                                  Try following @kshegunov's advice above and see if you can find more info on the crash. That might help you narrow it down in your code.

                                  My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                                  1 Reply Last reply
                                  0
                                  • mstothM Offline
                                    mstothM Offline
                                    mstoth
                                    wrote on last edited by
                                    #17

                                    Thank you all for your help. I will try to follow your suggestions and post any success here.

                                    mstothM 1 Reply Last reply
                                    1
                                    • mstothM mstoth

                                      Thank you all for your help. I will try to follow your suggestions and post any success here.

                                      mstothM Offline
                                      mstothM Offline
                                      mstoth
                                      wrote on last edited by mstoth
                                      #18

                                      @mstoth As I continue to work on this problem (very frustrating!) I have gotten to the point of just making a complete new form to replace a form that is giving me the segmentation violation. I found that if I create a blank form, it shows up fine. If i put one button on the form, and not even attach an action to the button, I get the segmentation violation (the identical looking stack trace shown above). I hope this may provide a clue to someone with more experience dealing with Qt. Is there anything one can do to a program that would allow you to create and show a blank form but not a form with a button? Desperate here! It still works on the embedded device, however I really can't do development on this product without it running on my desktop as well.

                                      A kshegunovK 2 Replies Last reply
                                      0
                                      • mstothM mstoth

                                        @mstoth As I continue to work on this problem (very frustrating!) I have gotten to the point of just making a complete new form to replace a form that is giving me the segmentation violation. I found that if I create a blank form, it shows up fine. If i put one button on the form, and not even attach an action to the button, I get the segmentation violation (the identical looking stack trace shown above). I hope this may provide a clue to someone with more experience dealing with Qt. Is there anything one can do to a program that would allow you to create and show a blank form but not a form with a button? Desperate here! It still works on the embedded device, however I really can't do development on this product without it running on my desktop as well.

                                        A Offline
                                        A Offline
                                        ambershark
                                        wrote on last edited by
                                        #19

                                        @mstoth Can you share your code for that form's class, and the code for the instantiation of the form/class?

                                        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                                        mstothM 1 Reply Last reply
                                        0
                                        • mstothM mstoth

                                          @mstoth As I continue to work on this problem (very frustrating!) I have gotten to the point of just making a complete new form to replace a form that is giving me the segmentation violation. I found that if I create a blank form, it shows up fine. If i put one button on the form, and not even attach an action to the button, I get the segmentation violation (the identical looking stack trace shown above). I hope this may provide a clue to someone with more experience dealing with Qt. Is there anything one can do to a program that would allow you to create and show a blank form but not a form with a button? Desperate here! It still works on the embedded device, however I really can't do development on this product without it running on my desktop as well.

                                          kshegunovK Offline
                                          kshegunovK Offline
                                          kshegunov
                                          Moderators
                                          wrote on last edited by kshegunov
                                          #20

                                          Try setting the QT_NO_FT_CACHE environment variable to something, either 0 or 1. This is done in the kit configuration you select the "Run" from the side panel (Qt creator 4.x) and then open the "Run environment list". I suspect this is a bug either in Qt, which is less likely at this point or in your redhat's version (or the fontconfig library). As reference look at this report (albeit quite old). And these bits in Qt's source:
                                          http://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/text/qfontengine_ft.cpp?h=5.7#n686
                                          http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/global/qglobal.cpp?h=5.7#n3235

                                          PS.
                                          Alternatively try a later Qt version, where qfontengine_ft "magically" disappeared. ;)

                                          Read and abide by the Qt Code of Conduct

                                          mstothM 1 Reply Last reply
                                          1

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved