Results 1 to 2 of 2

Thread: getAttribute() Causing heap corruption I think? Whats wrong?

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    2

    getAttribute() Causing heap corruption I think? Whats wrong?

    Using the colladaDOM to load .dae into directx format.

    Heres one of my functions, it is simple, takes in a node, gets a list of its children, and loops through them, in each loop it will make a string type variable and call the getAttribute("sid") to fill it out and then depending on what the string is, it will put some data in the array of a D3DXMATRIX.

    The function just fills out a matrix from the collada file.

    So it works perfect up to when it finishes it's first pass through the loop, and it is deallocating the string, debug assertion error. Allocating it works fine though.

    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 and files) settings.

    dbgheap.c Line:1322

    Expression: _CrtISValidHeapPointer(pUserData)

    D3DXMATRIX ColladaFileLoader:rocessMatrix(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;
    }

  2. #2
    Junior Member
    Join Date
    Oct 2011
    Posts
    2

    Re: getAttribute() Causing heap corruption I think? Whats wr

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •