App: Don't use std::forward inside loop

std::forward implies that sometimes its argument will be *moved*, leaving it invalid in the calling code. If that call is inside a loop that tries to reuse the data we have undefined behavior.
This commit is contained in:
Chris Hennes
2025-03-20 20:57:06 -05:00
committed by Benjamin Nauck
parent 4ceecd0857
commit c252f40b6f

View File

@@ -1955,7 +1955,7 @@ std::vector<std::string> updateLinkSubs(const App::DocumentObject* obj,
std::vector<std::string> res;
for (auto it = subs.begin(); it != subs.end(); ++it) {
const auto& sub = *it;
auto new_sub = (*f)(obj, sub.c_str(), std::forward<Args>(args)...);
auto new_sub = (*f)(obj, sub.c_str(), args...);
if (new_sub.size()) {
if (res.empty()) {
res.reserve(subs.size());