ACAPI_Element_Get crashes
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2010-12-30
10:12 AM
- last edited on
‎2023-08-03
10:31 AM
by
Doreena Deng
‎2010-12-30
10:12 AM
Hi,
I need to get rid of hotlinks created by my add-on, and I've found a nice example in the Element_Test code.
But for a mysterious reason, Archicad crashes when I call the ACAPI_Element_Get function...
Here's the code :
And I can't check the generated GSErrCode because Archicad crashes as soon as the function appear (no matter if the function is checked by "try...catch" method. Archicad just close everything and shows a nice BugReporter window...).
Does anyone have a clue ?
Thanks !
I need to get rid of hotlinks created by my add-on, and I've found a nice example in the Element_Test code.
But for a mysterious reason, Archicad crashes when I call the ACAPI_Element_Get function...
Here's the code :
//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...
And I can't check the generated GSErrCode because Archicad crashes as soon as the function appear (no matter if the function is checked by "try...catch" method. Archicad just close everything and shows a nice BugReporter window...).
Does anyone have a clue ?
Thanks !
Labels:
- Labels:
-
Add-On (C++)
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2013-07-09 11:51 AM
‎2013-07-09
11:51 AM
I've got the same problem. But I am using API_HotlinkNode instead of API_Element . Here is my code:
DBPrintf() ) on a Debug Window (DebugView). The data was printed but still the function crashes on exit.
Help anyone?
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 (
Help anyone?
~ReignBough~
ARCHICAD 27 INT (since AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
ARCHICAD 27 INT (since AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS