Segmentation fault in Qt application framework

前端 未结 2 1479
遥遥无期
遥遥无期 2021-01-26 07:10

this generates a segmentation fault becuase of \"QColor colorMap[9]\";. If I remove colorMap the segmentation fault goes away. If I put it back. It comes back. If I do a clean

相关标签:
2条回答
  • 2021-01-26 07:50

    If I do a clean all then build all, it goes away.

    This makes it sound as though your build system isn't recognizing a dependency and that a change to that class definition isn't triggering a rebuild of something that should be recompiled when the definition changes.

    Make sure class LevelIndicator is defined in exactly one place (generally that would be a header file that gets included by whatever modules need to use a LevelIndicator object). Also make sure that any global/static instances of LevelIndicator objects are following the one definition rule.

    0 讨论(0)
  • 2021-01-26 08:01

    Firstly it might not be QColor, that may simply be changing the memory layout enough that a buffer overrun somewhere else triggers a segfault - try a different size QColor ..[1] for example.

    Can QColor be used as an array like this, does it have the correct default ctor?

    0 讨论(0)
提交回复
热议问题