In our application we use an EmbeddedWizard class
It contains 5 variable, 4 of an autogenerated Enum Type and a bool. Also an Init, copy and compare methods are built.
Now we want to use an object of this class to transfer data from the device to the GUI. So in device autoobject we use:
We saw, that in EmbeddedWizard objects are transfered by reference. Using the ‘=’ operator for objects of type class EventItem, the reference (pointer to memory) is copied. Therefore EventMessage property is initialized with the VariableEventItem to offer memory storage, the UpdateEventMessage is implemented like this, using CopyFrom and IsEqual methods, which compare resp. copy the internal variables:
Using this UpdateEventMessage method from device code looks like this, getting data from a cpp class (rEventItem) which also has enum typed members:
device_event_item->Source = (EmWiUidListAutoGeneratedUidListEnum)rEventItem.mEventSource;
device_event_item->Type = (EmWiUidListAutoGeneratedUidListEnum)rEventItem.mEventType;
device_event_item->Classification = (EmWiUidListAutoGeneratedUidListEnum)rEventItem.mEventClassification;
device_event_item->Instruction = (EmWiUidListAutoGeneratedUidListEnum)rEventItem.mEventInstruction;
device_event_item->CreateOpenedPanel = false;
DeviceDeviceClass_UpdateEventMessage( mDeviceObject, device_event_item );
Using this construct leads to a segmentation fault at the first assignment (Source).
Is this the right way to construct an object from EmbeddedWizard defined class DeviceEventItem? Is there a garbage collector problem? What happens here?