xtypes
xtypes copied to clipboard
Seg Fault Copying xtypes::DynamicData
My first attempt to use this library failed. Here is a simple program that reproduces the failure.
#include <iostream>
#include <string>
#include "xtypes/xtypes.hpp"
using namespace eprosima;
xtypes::DynamicData getTestEnum()
{
xtypes::EnumerationType<uint32_t> testEnum("TestEnum");
testEnum.add_enumerator("item0");
testEnum.add_enumerator("item1");
testEnum.add_enumerator("item2");
xtypes::DynamicData test(testEnum);
std::cout << "Looks good here: " << test.to_string();
xtypes::DynamicData test2(test);
std::cout << "Here too: " << test2.to_string();
return test;
}
int main()
{
xtypes::DynamicData testData(getTestEnum());
std::cout << "Seg Faults here: " << testData.to_string();
return 0;
}
backtrace:
>&"bt\n"
>~"#0 0x000055555555c727 in eprosima::xtypes::ReadableDynamicDataRef::for_each(std::function<void (eprosima::xtypes::ReadableDynamicDataRef::ReadableNode const&)>) const (this=0x7fffffffe590, visitor=...) at /home/kyle/VGB/eprosima_xtypes/include/xtypes/DynamicData.hpp:407\n"
>~"#1 0x000055555555e141 in eprosima::xtypes::ReadableDynamicDataRef::to_string[abi:cxx11]() const (this=0x7fffffffe590) at /home/kyle/VGB/eprosima_xtypes/include/xtypes/DynamicDataImpl.hpp:124\n"
>~"#2 0x000055555555b237 in main () at /home/kyle/VGB/XtypesTest/main.cpp:24\n"
>2322^done