[LyX/master] Modify string list in place instead of copying it
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Mon Sep 30 11:00:49 UTC 2024
commit 1d64dbf543cdb35b169ba41d2d3ca35fb393ce33
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Sun Sep 29 21:45:08 2024 +0200
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();
More information about the lyx-cvs
mailing list