2010-12-30
10:12 AM
- last edited on
2023-08-03
10:31 AM
by
Doreena Deng
//Function's error code
GSErrCode err = NULL;
//Containing the hotlink
API_Element element;
GS::Array<API_Guid> nodeRefList;
if (ACAPI_Database (APIDb_GetHotlinkNodesID, NULL, &nodeRefList) == NoError)
{
for (UIndex iNode = 0; iNode < nodeRefList.GetSize (); iNode++)
{
BNZeroMemory (&element, sizeof (API_Element));
element.header.typeID = API_HotlinkID;
element.header.guid = nodeRefList[iNode];
ACAPI_OpenUndoableSession("Effacer module");
//Below is the crashing sentence
err = ACAPI_Element_Get(&element);
ACAPI_Database(APIDb_DeleteHotlinkNodeID, &nodeRefList[iNode], NULL);
ACAPI_CloseUndoableSession();
}
}
My first thought was that this function needed to be into an undoable session, but I still have the same issue...2013-07-09 11:51 AM
GS::Array<API_Guid> nodeRefList;
API_HotlinkTypeID type = APIHotlink_Module;
GSErrCode err = ACAPI_Database(APIDb_GetHotlinkNodesID, &type, &nodeRefList);
DBPrintf("node count: %d", nodeRefList.GetSize());
if (err==NoError)
{
UInt32 len = nodeRefList.GetSize();
for (UInt32 i=0; i<len; ++i)
{
API_HotlinkNode hotlinkNode;
BNZeroMemory(&hotlinkNode, sizeof(API_HotlinkNode));
hotlinkNode.guid = nodeRefList;
hotlinkNode.type = type;
err = ACAPI_Database(APIDb_GetHotlinkNodeID, &hotlinkNode, NULL);
if (err==NoError)
{
//... do something ...//
if (hotlinkNode.sourceLocation!=NULL)
delete hotlinkNode.sourceLocation;
if (hotlinkNode.userData.data!=NULL)
BMKillPtr (&hotlinkNode.userData.data);
}
else
return err;
}
}
else
return err;
I simply print the data (