-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly initialize result vector in music_rate_in_proxy::get_status() #1458
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline.
models/music_rate_in_proxy.h
Outdated
@@ -167,7 +167,7 @@ class music_rate_in_proxy : public DeviceNode | |||
|
|||
struct Buffers_ | |||
{ | |||
double data_; | |||
std::vector< double > data_; //!< The buffer for incoming data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hakonsbm Based on your previous analysis this update makes sense, but I wonder if a smaller change, namely changing
( *d )[ names::data ] = DoubleVectorDatum( new std::vector< double >( B_.data_ ) );
to
( *d )[ names::data ] = DoubleVectorDatum( new std::vector< double >( 1, B_.data_ ) );
so that we correctly create a single-element vector, would be the safer approach here to just fix this problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. But we should really have a test of this model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, would you create a follow-up issue for a proper review of this (and other music) proxies?
Based on review by @heplesser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks! 👍 conditioned on travis
Corrects the type of the
Buffers_::data_
variable in the MUSIC rate in proxy model.With the original uninitialised
double
, passing the variable to thestd::vector
constructor may lead to anstd::bad_alloc
error. This can happen when the model tries to copy the vector withThis PR changes the variable to an
std::vector
.Fixes #1449.