From ad77d462df7643131a8cb5bec7f2e6a65abf7ed3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 19 Oct 2023 10:23:41 +0200 Subject: [PATCH] PD: avoid creation of tmp. std::string in TaskAttacher::onRefName --- src/Mod/Part/Gui/TaskAttacher.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index 51aee23189..904f67056f 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -616,12 +616,12 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx) if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) { // everything is OK (we assume a Part can only have exactly 3 App::Plane objects located at the base of the feature tree) - subElement = ""; + subElement.clear(); } else if (obj->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) { // everything is OK (we assume a Part can only have exactly 3 App::Line objects located at the base of the feature tree) - subElement = ""; + subElement.clear(); } else if (obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) { - subElement = ""; + subElement.clear(); } else { // TODO: check validity of the text that was entered: Does subElement actually reference to an element on the obj? @@ -669,10 +669,10 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx) std::vector refnames = pcAttach->Support.getSubValues(); if (idx < refs.size()) { refs[idx] = obj; - refnames[idx] = subElement.c_str(); + refnames[idx] = subElement; } else { refs.push_back(obj); - refnames.emplace_back(subElement.c_str()); + refnames.emplace_back(subElement); } pcAttach->Support.setValues(refs, refnames); updateListOfModes();