Hello,
I'm back with a problem !
I'm experiencing some XSI crashes with some piece of code, and I have no idea on how to resolve this.
Here is some code that runs fine :
CSIBCString *templateNameStr = new CSIBCString("CC_Test");
CdotXSITemplate *dotXSITemplate = new CdotXSITemplate(templateNameStr);
dotXSITemplate->m_ReadCallback = CC_ReadTest;
dotXSITemplate->m_WriteCallback = CC_WriteTest;
CSLModel *ftkModel = ftkScene->Root()->AddModel();
ftkModel->Template()->Children().Add(dotXSITemplate);
But
when I try to get a CdotXSITemplate with the FindByType function, and
that I try to add it into a CdotXSITemplates array, it sometimes works,
sometimes crashes XSI.
Little example :
CSLModel *ftkModel = ftkScene->Root()->AddModel();
CdotXSITemplate *dotXSITemplate = ftkScene->Parser()->GetdotXSINativeTemplates()->FindByType("XSI_CustomPSet");
ftkModel->Template()->Children().Add(dotXSITemplate);
This code have the same effects :
CSLModel *ftkModel = ftkScene->Root()->AddModel();
CdotXSITemplates *dotXSITemplates = ftkScene->Parser()->GetdotXSINativeTemplates();
CdotXSITemplate *dotXSITemplate = NULL;
for (LONG i = 0; i < dotXSITemplates->GetCount(); i++) {
if (dotXSITemplates->Item(i)->Name() == "XSI_CustomPSet") {
dotXSITemplate = dotXSITemplates->Item(i);
break;
}
}
if (dotXSITemplate) {
ftkModel->Template()->Children().Add(dotXSITemplate);
}
If I put a comment on the "ftkModel->Template()->Children().Add(dotXSITemplate);" line in both of the piece of codes above, it don't crash anymore.
So, can anyone please tell me what's wrong ?
I'm using the Crosswalk 2.04 version.
Thank you,
Christopher.