Hello Jonas,
what does STR_Create() do? From your implementation it looks as if it creates a reference to a property. But there is no property specified. Property references can interconnect several objects. During Garbage Collection the order in which objects are disposed (and the methods Done() are invoked) is not predicable. A property reference can thus refer to a property belonging to a previously released object. Trying to access the referenced property may crash the system. Therefore Embedded Wizard reports the error message.
Should STR_Create() just allocate some data structure and return the pointer to this structure, use handle data type to store the pointer in EW application. Don't use ^handle which in fact represents a reference to a property able to store a handle. Doing this is even problematic, because during Garbage Collection the pointer to the data structure (stored in ^handle) is evaluated as a reference to a property. When the Garbage Collection follows this reference, it misinterprets it causing again a crash.
Following ideas:
Step 1: Change the declaration of the reference variable form ^handle to handle.
Step 2: Change the declaration of the local variables hand form ^handle to handle.
See also the section Data types: handle.
I hope it helps you further.
Best regards
Paul Banach