intrusive_ptr =>; _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
我在代码中使用 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
I use boost 'intrusive_ptr' in my code but when I delete some objects I got a crash !
In fact I use the same 'intrusive_ptr' into a class and return it, like this :
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论