Fix lifetime issue
There's possible lifetime issue with objects_name variable. This variable is passed as argument by reference and it's captured in a lambda, also by reference. Then, the lambda is returned. This caused the object to be used after ended its lifetime when passed to ilog function. This resulted in logic_error exception being thrown from std::string constructor. To fix this, change the function to take the variable by copy and then move into lambda capture. While here, also change capture of description variable to be copied. This seems to work fine, but I'm not sure if it's guaranteed, considering we're capturing it and also moving as a argument at the same time.
Loading
Please sign in to comment