1

This really has me stumped.

We have a class with a dozen or so getters and setters defined, that take a mix of types (QString, int, bool) for the various member variables. I'm currently adding a new set of functions and variables for some additional data, everything builds fine however when I run the code and it creates a new instance of that class as a boost::shared_ptr, then I immediately get a segfault in in QBasicAtomicInt::deref (this=0x0) at /usr/local/Trolltech/Qt-4.8.1/include/QtCore/qatomic_i386.h:132.

I can take it further as well, if I add just the getter and the variable, it'll no longer segfault. If I change the variable to a bool instead of a QString, it'll work, however if I change to a std::string it'll still segfault in the same place which is even weirder as the variable is no longer a Qt one. If I create a new instance of the class without it being a boost::shared_ptr it's fine, no problems at all. The functions aren't used internally, or externally in the class yet.

4

2 回答 2

2

我有一个类似的问题。

我只是在一个类中创建一个变量,当尝试使用时会导致分段错误,我快疯了!

我的环境类似:一个在 Linux 上使用 Qt 的软件,用 C++ 语言编写。

所以我清理了项目并重建,然后工作正常!

StackOverflow 保存!

于 2017-09-04T08:45:41.090 回答
1

删除目录并重新提取代码,重建并且它可以工作。我不知道为什么,我猜清理过程没有正确清理掉一些东西。

于 2013-02-06T20:25:45.013 回答