ColladaDOM 加载程序调试字符串上的断言错误?
D3DXMATRIX ColladaFileLoader::processMatrix(daeElement* node)
{
D3DXMATRIX matWorld;
daeTArray<daeElementRef> nodeChildren = node->getChildren();
for (int i = 0; i < nodeChildren.getCount(); i++)
{
string type = nodeChildren[i]->getAttribute("sid");
if (type == "rotationX")
{
string data = nodeChildren[i]->getCharData();
stringstream stm(data);
stm >> matWorld.m[0][0];
stm >> matWorld.m[0][1];
stm >> matWorld.m[0][2];
stm >> matWorld.m[0][3];
}
if (type == "rotationY")
{
string data = nodeChildren[i]->getCharData();
stringstream stm(data);
stm >> matWorld.m[1][0];
stm >> matWorld.m[1][1];
stm >> matWorld.m[1][2];
stm >> matWorld.m[1][3];
}
if (type == "rotationZ")
{
string data = nodeChildren[i]->getCharData();
stringstream stm(data);
stm >> matWorld.m[2][0];
stm >> matWorld.m[2][1];
stm >> matWorld.m[2][2];
stm >> matWorld.m[2][3];
}
if (type == "location")
{
string data = nodeChildren[i]->getCharData();
stringstream stm(data);
stm >> matWorld.m[3][0];
stm >> matWorld.m[3][1];
stm >> matWorld.m[3][2];
matWorld.m[3][3] = 1;
}
}
return matWorld;
}
该函数将在第一次循环结束后运行“运行调试断言失败”。循环将正确运行,它将进入最后一个 if 语句并正确设置所有值。但是,当该传递完成并开始下一个传递之前,它将调试断言对我失败。我认为它试图破坏字符串类型变量,但当它尝试删除它时,有些东西正在破坏。我不知道问题是什么。它似乎在我的程序的其他部分上执行此操作,从文件中获取字符串并将其放入 std::string 中。我通过完全删除它们来修复这些问题,但这个无法删除,它需要存在。
不知道这是否与此有关,但我正在使用 Visual Studio 11 开发预览版,并使用编译器 vs100 (vs10 的编译器)设置。
dbgheap.c 行:1322
表达式:_CrtISValidHeapPointer(pUserData)
当我使用调试器时,此函数中的任何变量在错误后都不会显示。
D3DXMATRIX ColladaFileLoader::processMatrix(daeElement* node)
{
D3DXMATRIX matWorld;
daeTArray<daeElementRef> nodeChildren = node->getChildren();
for (int i = 0; i < nodeChildren.getCount(); i++)
{
string type = nodeChildren[i]->getAttribute("sid");
if (type == "rotationX")
{
string data = nodeChildren[i]->getCharData();
stringstream stm(data);
stm >> matWorld.m[0][0];
stm >> matWorld.m[0][1];
stm >> matWorld.m[0][2];
stm >> matWorld.m[0][3];
}
if (type == "rotationY")
{
string data = nodeChildren[i]->getCharData();
stringstream stm(data);
stm >> matWorld.m[1][0];
stm >> matWorld.m[1][1];
stm >> matWorld.m[1][2];
stm >> matWorld.m[1][3];
}
if (type == "rotationZ")
{
string data = nodeChildren[i]->getCharData();
stringstream stm(data);
stm >> matWorld.m[2][0];
stm >> matWorld.m[2][1];
stm >> matWorld.m[2][2];
stm >> matWorld.m[2][3];
}
if (type == "location")
{
string data = nodeChildren[i]->getCharData();
stringstream stm(data);
stm >> matWorld.m[3][0];
stm >> matWorld.m[3][1];
stm >> matWorld.m[3][2];
matWorld.m[3][3] = 1;
}
}
return matWorld;
}
This function will run run debug assertion failed after it ends the first pass through the loop. The loop will run correctly, it will enter the last if statement and set all values correctly. However when the pass is done and before it starts the next pass it will debug assertion failed on me. I think it is trying to destroy the string type variable but something is breaking when it does tries to delete it. I don't know what the problem is. It seems to do this on other parts of my program that get strings from the file and place in std::string. I fixed those by just removing those entirely but this one cannot be removed it needs to exist.
Don't know if this has anything to do with it, but I'm using visual studio 11 dev preview, and using compiler vs100 (vs10's compiler) settings.
dbgheap.c
Line:1322
Expression: _CrtISValidHeapPointer(pUserData)
also when i use debugger none of my vars from this function show up after the error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,在我用头撞墙近一周后发现了这个问题,对于将来可能遇到这个问题的其他人,我将发布解决方案。
我使用的 colladaDOM 版本是使用 /mDd 库(多线程调试 dll)编译的,而我的项目使用 /mtd(多线程调试静态)设置。将我的项目更改为 /MDd 后,所有问题都消失了。
另一种可能的解决方案是使用 /mtd 重建 DOM 以匹配项目设置。
Ok found the problem after nearly a week of beating my head against the wall, for others who may have run into this issue in the future I'll post the solution.
The version of colladaDOM I used was compiled with /mDd library (multi-threaded debug dll) while my project was using /mtd (multi threaded debug static) settings. After changing my project to /MDd all my problems vanished.
Another possible solution would be to rebuild DOM with /mtd to match the project settings.