EventData attr_value is NULL when push_event_failed
Hello,
It would be nice if attr_value (DeviceAttribute) would not be null is case of push_event failure and that the error_list of the DeviceAttribute object is set (as for read_attributes call). This would make error handling more convenient. To work around this I tried the following code but it fails when deleting the error stack. Is there a way to build a copy of the error stack and pass it to the dummy DeviceAttribute object used for error ? Any other tips would be welcome ;)
Inside a Tango::Callback:
void push_event(Tango::EventData *event) {
if (event->err) {
// Create an error DeviceAttribute
event->attr_value = new Tango::DeviceAttribute();
event->attr_value->exceptions(Tango::DeviceAttribute::except_flags::failed_flag);
event->attr_value->set_error_list(&event->errors);
}
// GraphQL stuff
string result;
GQLDeviceAttribute *gqlda = new GQLDeviceAttribute(*(event->attr_value));
req->execute(gqlda,result);
// Free data
delete event->attr_value; // Crash here in Tango::DevErrorList_var::~DevErrorList_var()
event->attr_value = nullptr; // The DeviceAttribute is deleted here (The EventData will get nullptr)
delete gqlda;
}
Crash point:
je 0x7f893cbc2fe3 ; <Tango::DeviceAttribute::~DeviceAttribute()+35>
callq 0x7f893cb4d610 ; <operator delete(void*)@plt>
lea 0xc0(%rbx),%rdi
callq 0x7f893cb4b770 ; <Tango::DevErrorList_var::~DevErrorList_var()@plt> <= Crash