cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Crashing at ~API_HotlinkNode()

ReignBough
Enthusiast

Getting this message on the crash breakpoint:

Critical error detected c0000374
A breakpoint instruction (__debugbreak() statement or a similar call) was executed in Archicad.exe.

 

This happened here:

GS::Array<API_Guid>& hotlinks;
//.. more codes here that retrieves hotlink guids
for (UInt32 i = 0; i < hotlinks.GetSize(); ++i)

{
//get the hotlink node
API_HotlinkNode hotlinkNode = Hotlink::GetNode(hotlinks[i]);
GS::UniString nameUStr = hotlinkNode_1.name;
if (!FilterHotlinkName(nameUStr))
continue; <== crashes here
// .. more codes here
}

FilterHotlinkName() checks the name if it follows a certain format and if it is valid value. Hotlink::GetNode() handles correct ArchiCAD version calls:

API_HotlinkNode Hotlink::GetNode(API_Guid i_guid)
{
API_HotlinkNode hotlinkNode = {};
hotlinkNode.guid = i_guid;
#if ARCHICAD_VER >= 27
LastGSErr = ACAPI_Hotlink_GetHotlinkNode(&hotlinkNode);
#else
LastGSErr = ACAPI_Database(APIDb_GetHotlinkNodeID, &hotlinkNode);
#endif
return hotlinkNode;
}

Specifically, the crash happens here (APIdefs_Database.h):

~API_HotlinkNode ()
{ vvvvvvvvvvvvvvvvvvvvv==== crashes here
delete sourceLocation; sourceLocation = nullptr;
delete serverSourceLocation; serverSourceLocation = nullptr;
BMKillPtr (&userData.data);
}

 

~ReignBough~
ARCHICAD 27 INT (since AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Oleg
Expert

I guess about reason.

Actually, you can not copy and assign the API_HotlinkNode structure. 
Formally this structure have to declare empty copy constructor snd assignmen operator to protect it, as it has such destructor.
So you can not to return API_HotlinkNode from the GetNode function by value.

For example, you may to implement the GetNode function like this: bool GetNode( const API_Guid& guid, API_HotlinkNode* node ).

View solution in original post

1 REPLY 1
Solution
Oleg
Expert

I guess about reason.

Actually, you can not copy and assign the API_HotlinkNode structure. 
Formally this structure have to declare empty copy constructor snd assignmen operator to protect it, as it has such destructor.
So you can not to return API_HotlinkNode from the GetNode function by value.

For example, you may to implement the GetNode function like this: bool GetNode( const API_Guid& guid, API_HotlinkNode* node ).