From 1d64dbf543cdb35b169ba41d2d3ca35fb393ce33 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sun, 29 Sep 2024 21:45:08 +0200 Subject: [PATCH] Modify string list in place instead of copying it Spotted by Coverity scan. --- src/frontends/qt/GuiBibtex.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/frontends/qt/GuiBibtex.cpp b/src/frontends/qt/GuiBibtex.cpp index 47dda81032..e6eff146f5 100644 --- a/src/frontends/qt/GuiBibtex.cpp +++ b/src/frontends/qt/GuiBibtex.cpp @@ -317,14 +317,10 @@ void GuiBibtex::relAbsPressed() QString const new_item = (p == LP_Absolute) ? toqstr(file.relPath(buffer().filePath())) : toqstr(file.absoluteFilePath()); - QStringList sb; - for (QString s : selected_bibs_) { + for (QString & s : selected_bibs_) { if (s == qf) - sb << new_item; - else - sb << s; + s = new_item; } - selected_bibs_ = sb; setSelectedBibs(selected_bibs_); selectedLV->selectRow(selected_bibs_.indexOf(new_item)); changed(); -- 2.39.5