I'm trying to build a composite pattern in Twincat 3.1.
Everything seems to work fine on Activate Configuration and the first new download or online change. The second new download causes General Protection Error or BSOD, no matter how many objects I add or remove.
For simplicity, Object is FB implementing the I_SYS_COMP_Object interface.
The project uses FB_init and FB_exit to add or remove objects from the global object list. Previous iterations used call_after_init attributes with the same result.
As the code became lengthy, I'm adding a link to the repository. GitHub rep
How should I approach this kind of issue?
Edit 26/11:
Core dump and exception mode don't work.
So far, I have found that:
IF object <> 0 THEN
RETURN;
END_IF
_this_object = THIS^;
IF object.parent <> THIS^ THEN
RETURN;
END_IF
was part of the problem. Now I'm getting BSOD a few lines below, at
_last_child := object;
Which is strange as this should be a straightforward assignment. Currently, _last_child is used only in the problematic method. I put a RETURN; straight after the assignment, but I'm still getting BSOD.