adam-markovics commented on a change in pull request #1284:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1284#discussion_r832042678
##########
File path: libminifi/src/FlowController.cpp
##########
@@ -523,14 +537,14 @@ void
FlowController::getAllProcessorControllers(std::vector<state::StateControll
}
}
-void FlowController::getProcessorController(const std::string& name,
std::vector<state::StateController*>& controllerVec,
+void FlowController::getProcessorController(const std::string& name,
state::StateController*& controller,
const
std::function<std::unique_ptr<state::ProcessorController>(core::Processor&)>&
controllerFactory) {
auto* processor = root_->findProcessorByName(name);
- auto& controller = processor_to_controller_[processor->getUUID()];
- if (!controller) {
- controller = controllerFactory(*processor);
+ auto& foundController = processor_to_controller_[processor->getUUID()];
+ if (!foundController) {
+ foundController = controllerFactory(*processor);
}
- controllerVec.push_back(controller.get());
+ controller = foundController.get();
Review comment:
It's not dangling, because `foundController` is a reference to the found
value in the map. The created controller is going to be stored there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]