mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-04 04:52:09 +08:00
replay: fix dangling pointers in logging calls (#36738)
fix dangling pointers in logging calls
This commit is contained in:
@@ -31,6 +31,8 @@ void Replay::setupServices(const std::vector<std::string> &allow, const std::vec
|
||||
sockets_.resize(event_schema.getUnionFields().size(), nullptr);
|
||||
|
||||
std::vector<const char *> active_services;
|
||||
active_services.reserve(services.size());
|
||||
|
||||
for (const auto &[name, _] : services) {
|
||||
bool is_blocked = std::find(block.begin(), block.end(), name) != block.end();
|
||||
bool is_allowed = allow.empty() || std::find(allow.begin(), allow.end(), name) != allow.end();
|
||||
@@ -40,7 +42,9 @@ void Replay::setupServices(const std::vector<std::string> &allow, const std::vec
|
||||
active_services.push_back(name.c_str());
|
||||
}
|
||||
}
|
||||
rInfo("active services: %s", join(active_services, ", ").c_str());
|
||||
|
||||
std::string services_str = join(active_services, ", ");
|
||||
rInfo("active services: %s", services_str.c_str());
|
||||
if (!sm_) {
|
||||
pm_ = std::make_unique<PubMaster>(active_services);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,8 @@ bool SegmentManager::mergeSegments(const SegmentMap::iterator &begin, const Segm
|
||||
auto &merged_events = merged_event_data->events;
|
||||
merged_events.reserve(total_event_count);
|
||||
|
||||
rDebug("merging segments: %s", join(segments_to_merge, ", ").c_str());
|
||||
std::string segments_str = join(segments_to_merge, ", ");
|
||||
rDebug("merging segments: %s", segments_str.c_str());
|
||||
for (int n : segments_to_merge) {
|
||||
const auto &events = segments_.at(n)->log->events;
|
||||
if (events.empty()) continue;
|
||||
|
||||
Reference in New Issue
Block a user