Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QString constructor segfault. qshaderdescription.cpp corruption
Qt 6.12 LTS is out! See what's new in the release blog

QString constructor segfault. qshaderdescription.cpp corruption

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 564 Views 1 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.
  • R Offline
    R Offline
    ridderhoff
    wrote on last edited by
    #1

    A few function calls past our main function a QString gets constructed and segfaults with the following stack trace

    (gdb) bt
    #0  0x000000000044d60b in int QAtomicOps<int>::loadRelaxed<int>(std::atomic<int> const&) ()
    #1  0x000000000044ceb8 in QBasicAtomicInteger<int>::loadRelaxed() const ()
    #2  0x000000000044c46e in QtPrivate::RefCount::ref() ()
    #3  0x000000000044ca67 in QString::QString(QString const&) ()
    ...
    

    I assumed that our project was doing something unsafe with memory and recompiled with libefence so that I could figure out what was causing the problem.

    (gdb) bt
    #0  QString::fromLatin1_helper (str=str@entry=0x7ffff5b6562b "float", size=size@entry=5) at text/qstring.cpp:5462
    #1  0x00007ffff563ac75 in QString::QString (aLatin1=..., this=0x7ffff5e7d7c0 <typeTab>)
        at ../../include/QtCore/../../src/corelib/text/qstring.h:1067
    #2  __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at rhi/qshaderdescription.cpp:666
    #3  _GLOBAL__sub_I_qshaderdescription.cpp(void) () at rhi/qshaderdescription.cpp:1513
    #4  0x00007ffff7de3e0a in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffdbd8, env=env@entry=0x7fffffffdbe8)
        at dl-init.c:72
    #5  0x00007ffff7de3f0a in call_init (env=0x7fffffffdbe8, argv=0x7fffffffdbd8, argc=1, l=<optimized out>) at dl-init.c:30
    #6  _dl_init (main_map=0x7ffff7ffe1f0, argc=1, argv=0x7fffffffdbd8, env=0x7fffffffdbe8) at dl-init.c:119
    #7  0x00007ffff7dd501a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
    

    This suggests that the problem is the result of a static variable in the gui/rhi component using QStrings as static variables before they're ready. Checking git I found that these keys were changed to const char* and this change/fix should be live in recent versions of Qt 6.

    Apart from upgrading our entire software to Qt 6 is there anything I can do to make this work? I feel like if the issue should be experienced by more Linux developers since as far as I know we're not actually using any of the features in RHI directly. We currently have software working with Qt 5.15.2 on Windows but struggling with the Linux port.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Can you trigger that with a minimal compilable example ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

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