Hello, we are experiencing a crash on one of our screens
An example in semi pseudo code, we have defined a native method in chora called passString()
native void passString(uint32 aStringPointer){
char *myString = (char*) aStringPointer;
StringWrapper stringWrapper = EwNewObject( StringWrapper , 0 );
stringWrapper->theString = EwNewStringAnsi(myString);
CoreSystemEvent_Trigger( &_this->SystemNewString, ((XObject)stringWrapper), 0 );
}
This method is called from the C side, and passes a pointer to a string, we create a wrapper class for the string and assign the varible theString via EwNewStringAnsi(myString);
We then fire off a system event which is picked up by our UI, the string appears, and then we get a crash...
The method we are using to display the string is as follows: On our screen, we receive the event and process it as follows:
slot SystemNewStringHandler{
var StringWrapper stringWrapper = (StringWrapper)SystemNewStringHandler.Context;
StatusLabel.String = stringWrapper.theString;
}
How do we avoid the unmanaged string panic in this circumstance? Must we keep a reference to my passed stringWrapper on my screen? Otherwise it gets deleted when the method returns?
Thank you very much!