[
https://issues.apache.org/jira/browse/MINIFICPP-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16493791#comment-16493791
]
ASF GitHub Bot commented on MINIFICPP-513:
------------------------------------------
Github user achristianson commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/346#discussion_r191486723
--- Diff: libminifi/src/controllers/NetworkPrioritizerService.cpp ---
@@ -65,33 +65,38 @@ void NetworkPrioritizerService::yield() {
/**
* If not an intersecting operation we will attempt to locate the highest
priority interface available.
*/
-io::NetworkInterface &&NetworkPrioritizerService::getInterface(uint32_t
size = 0) {
+io::NetworkInterface NetworkPrioritizerService::getInterface(uint32_t size
= 0) {
std::vector<std::string> controllers;
+ std::string ifc = "";
if (!network_controllers_.empty()) {
if (sufficient_tokens(size) && size < max_payload_) {
controllers.insert(std::end(controllers),
std::begin(network_controllers_), std::end(network_controllers_));
}
}
if (!controllers.empty()) {
- auto ifc = get_nearest_interface(controllers);
+ ifc = get_nearest_interface(controllers);
if (!ifc.empty()) {
reduce_tokens(size);
- return std::move(io::NetworkInterface(ifc, shared_from_this()));
+ io::NetworkInterface newifc(ifc, shared_from_this());
+ return newifc;
}
}
for (size_t i = 0; i < linked_services_.size(); i++) {
auto np =
std::dynamic_pointer_cast<NetworkPrioritizerService>(linked_services_.at(i));
if (np != nullptr) {
auto ifcs = np->getInterfaces(size);
- auto ifc = get_nearest_interface(ifcs);
+ ifc = get_nearest_interface(ifcs);
if (!ifc.empty()) {
np->reduce_tokens(size);
- return std::move(io::NetworkInterface(ifc, np));
+ io::NetworkInterface newifc(ifc, np);
+ return newifc;
--- End diff --
Likewise.
> RVO causing seg fault due to taking reference to transient
> -----------------------------------------------------------
>
> Key: MINIFICPP-513
> URL: https://issues.apache.org/jira/browse/MINIFICPP-513
> Project: NiFi MiNiFi C++
> Issue Type: Bug
> Reporter: marco polo
> Assignee: marco polo
> Priority: Major
>
> RVO causing seg fault due to taking reference to transient on certain
> compilers. Additionally, during profiling found that elision was prevented,
> so we should avoid using the rvalue reference for the return and move
> semantics and let the compiler take care of the optimization.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)