intrusive_ptr => _BLOCK_TYPE_IS_VALID(pHead-> nBlockUse)

时间:2011-05-18 10:07:00

标签: c++ pointers

我在代码中使用了boost'intrusive_ptr'但是当我删除一些对象时,我遇到了崩溃!

事实上我在一个类中使用相同的'intrusive_ptr'并返回它,如下所示:

typedef intrusive_ptr<Node> ref;

class MyContainer
{
ref SmartPointer;
};

class Compiler
{
private:
ref MyNode;

public:
ref getMyNode() { return MyNode; }
    ref process() {MyNode.Reset(); ... return MyNode; }
};

MyContainer * c1 = new MyContainer();
c1->SmartPointer = compiler.process();

delete c1; <= CRASH

0 个答案:

没有答案