boschrexroth / ctrlx-automation-sdk

ctrlX AUTOMATION Software Development Kit
https://boschrexroth.github.io/ctrlx-automation-sdk/
Other
69 stars 24 forks source link

DatalayerClientSub segmentation fault #16

Closed OsamaOAyoub closed 3 months ago

OsamaOAyoub commented 1 year ago

Hello,

I have a datalayerClientSub that was running fine and was written based on the sample code provided. However, I had to reinstall my OS and reinstall all libraries including the debian package ctrlx-datalayer and since then there is a specific line causing a segmentation fault.

The segmentation fault happens in the constructor of the datalayerClientSub:

DataLayerClientSub::DataLayerClientSub(const comm::datalayer::DatalayerSystem &datalayerSystem, const std::string &connectionClient)
{
  _datalayerSystem = datalayerSystem;
  _connectionClient = connectionClient;
}

It happens when assigning _datalayerSystem the value of datalayerSystem which is passed when the object is created in main:

auto dataLayerClientSub = new DataLayerClientSub(datalayerSystem, connectionString);

I am not sure what is causing the problem exactly since it was working fine before and I guess assigning the datalayerSystem to the private object _datalayerSystem should be fine.

I also tried to adapt my code to the updated sample, the same problem occurs which is assigning the passed object to the private object.

Thanks, Osama

guidfort commented 5 months ago

Only one constructor is called here. If the segment fault comes from this, then the problem is before.

From the description of "DataLayerClientSub" I see that you use a stand 3 years ago. We have revised "DataLayerClientSub" and you can test the example from the SDK if you have problems with it.

I tested it once. With the current example and three years ago, I have no problem.