pazeshun / vl53l0x_mraa_ros

ROS package for using VL53L0X with libmraa
1 stars 1 forks source link

Segmentation fault when using vector of Vl53l0xMraa #1

Open pazeshun opened 5 years ago

pazeshun commented 5 years ago
std::vector<Vl53l0xMraa> lox;
lox.push_back(Vl53l0xMraa());
lox[0].begin(&i2c);

will cause segmentation fault.

pazeshun commented 5 years ago

Temporary solution: using boost::scoped_array(C++03) or std::unique_ptr(C++11)

#include <boost/scoped_array.hpp>
boost::scoped_array<Vl53l0xMraa> lox(new Vl53l0xMraa[1]);
lox[0].begin(&i2c);