开发者

A crash on a curly bracket: debug assertion faild

I have a piece of 开发者_StackOverflow中文版code that runs in debug mode in VS2008, C++. The problem is that when I am debugging the code line by line, at a very weird point of the code, it crashes and says:

debug assertion faild. Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

The crash point is on the first closed curly bracket (after mesh->edges[e].needsUpdate=false;) I don't understand why on a curly bracket? does that make sense to you guys?

What is going on?

for(int e=0; e<mesh->edges.size(); e++)
{
    if(mesh->edges[e].valid && mesh->edges[e].v[0]>=0 && mesh->edges[e].v[1]>=0 &&
        mesh->points[mesh->edges[e].v[0]].writable && mesh->points[mesh->edges[e].v[1]].writable)
    {
        //update v_hat and its corresponding error
        DecEdge Current = DecEdge(e);
        pair<Point, float> ppf = computeVhat(e);
        Current.v_hat = ppf.first;
        Current.error = ppf.second;

        edgeSoup.push(Current);
        mesh->edges[e].needsUpdate=false;
    }
}


In my experience, crashes that happen on a closing brace mean that the crash happened in a destructor that ran when the block went out of scope. I'd check what's happening in the destructors for DecEdge and Point.


You have some libraries compiled in DEBUG mode and some in RELEASE mode.


Check if you have deleted any of the pointers that u have used. This can be a reason.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜