Skip to content

Commit

Permalink
Fix capturing references to stack variables
Browse files Browse the repository at this point in the history
These were reported in COVESA#730

Co-authored-by: Aram Khzarjyan <[email protected]>
Co-authored-by: Sambit Patnaik <[email protected]>
  • Loading branch information
3 people committed Oct 11, 2024
1 parent 4296a4c commit daa82a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions implementation/configuration/src/configuration_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ configuration_impl::configuration_impl(const std::string &_path)
has_dlt_log_(false),
logfile_("/tmp/vsomeip.log"),
loglevel_(vsomeip_v3::logger::level_e::LL_INFO),
is_suppress_events_enabled_(false),
is_sd_enabled_(VSOMEIP_SD_DEFAULT_ENABLED),
sd_protocol_(VSOMEIP_SD_DEFAULT_PROTOCOL),
sd_multicast_(VSOMEIP_SD_DEFAULT_MULTICAST),
Expand Down Expand Up @@ -172,6 +173,8 @@ configuration_impl::configuration_impl(const configuration_impl &_other)
sd_port_ = _other.sd_port_;
sd_protocol_ = _other.sd_protocol_;

is_suppress_events_enabled_ = _other.is_suppress_events_enabled_;

sd_initial_delay_min_ = _other.sd_initial_delay_min_;
sd_initial_delay_max_ = _other.sd_initial_delay_max_;
sd_repetitions_base_delay_= _other.sd_repetitions_base_delay_;
Expand Down
8 changes: 4 additions & 4 deletions implementation/endpoints/src/tcp_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void tcp_client_endpoint_impl::receive() {
its_recv_buffer = recv_buffer_;
}
auto self = std::dynamic_pointer_cast< tcp_client_endpoint_impl >(shared_from_this());
strand_.dispatch([self, &its_recv_buffer](){
strand_.dispatch([self, its_recv_buffer](){
self->receive(its_recv_buffer, 0, 0);
});
}
Expand Down Expand Up @@ -770,7 +770,7 @@ void tcp_client_endpoint_impl::receive_cbk(
}
its_lock.unlock();
auto self = std::dynamic_pointer_cast< tcp_client_endpoint_impl >(shared_from_this());
strand_.dispatch([self, &_recv_buffer, _recv_buffer_size, its_missing_capacity](){
strand_.dispatch([self, _recv_buffer, _recv_buffer_size, its_missing_capacity](){
self->receive(_recv_buffer, _recv_buffer_size, its_missing_capacity);
});
} else {
Expand Down Expand Up @@ -798,7 +798,7 @@ void tcp_client_endpoint_impl::receive_cbk(
} else {
its_lock.unlock();
auto self = std::dynamic_pointer_cast< tcp_client_endpoint_impl >(shared_from_this());
strand_.dispatch([self, &_recv_buffer, _recv_buffer_size, its_missing_capacity](){
strand_.dispatch([self, _recv_buffer, _recv_buffer_size, its_missing_capacity](){
self->receive(_recv_buffer, _recv_buffer_size, its_missing_capacity);
});
}
Expand Down Expand Up @@ -948,7 +948,7 @@ void tcp_client_endpoint_impl::send_cbk(boost::system::error_code const &_error,
if (its_entry.first) {
auto self = std::dynamic_pointer_cast< tcp_client_endpoint_impl >(shared_from_this());
strand_.dispatch(
[self, &its_entry]() { self->send_queued(its_entry);}
[self, its_entry]() mutable { self->send_queued(its_entry);}
);
}
}
Expand Down

0 comments on commit daa82a5

Please sign in to comment.