【问题标题】:A crash on a curly bracket: debug assertion faild大括号崩溃:调试断言失败
【发布时间】:2010-06-02 01:35:00
【问题描述】:

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

调试断言失败。 表达式:_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;
    }
}

【问题讨论】:

  • 这到底是怎么回事???

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


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多