]> git.lyx.org Git - lyx.git/commitdiff
Modify string list in place instead of copying it master
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 29 Sep 2024 19:45:08 +0000 (21:45 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 30 Sep 2024 09:20:48 +0000 (11:20 +0200)
Spotted by Coverity scan.

src/frontends/qt/GuiBibtex.cpp

index 47dda81032fd726bd0da2dd7c13be5414c4f12dc..e6eff146f5f387c128accfbffd71cd6a192e9423 100644 (file)
@@ -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();