粉碎大括号:调试断言失败

时间:2010-06-02 01:35:01

标签: debugging crash visual-c++-2008

我有一段代码在VS2008,C ++中以调试模式运行。 问题是,当我逐行调试代码时,在代码的一个非常奇怪的地方,它崩溃并说:

  

debug assertion faild。   表达式:_BLOCK_TYPE_IS_VALID(pHead-> nBlockUse)

崩溃点在第一个封闭的大括号上(在mesh-> edges [e] .needsUpdate = false;之后) 我不明白为什么在花括号?这对你们有意义吗?

发生了什么事?

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;
    }
}

3 个答案:

答案 0 :(得分:1)

根据我的经验,在右括号上发生的崩溃意味着崩溃发生在一个析构函数中,该析构函数在块超出范围时运行。我会检查DecEdgePoint的析构函数中发生了什么。

答案 1 :(得分:0)

检查是否删除了您使用过的任何指针。这可能是一个原因。

答案 2 :(得分:0)

您有一些在DEBUG模式下编译的库,一些在RELEASE模式下编译。