From 51eb8ed81381252a17e9f40b604b5f8044fdca68 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sun, 26 Feb 2023 09:14:41 -0600 Subject: [PATCH] Spreadsheet: Fix unintended copies --- src/Mod/Spreadsheet/App/Sheet.cpp | 6 +++--- src/Mod/Spreadsheet/Gui/SheetTableView.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index 2c8ea5b200..c773a3daca 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -1234,7 +1234,7 @@ void Sheet::insertColumns(int col, int count) void Sheet::removeColumns(int col, int count) { // Remove aliases, if defined - for (auto address : cells.getColumns(col, count)) { + for (const auto &address : cells.getColumns(col, count)) { auto cell = getCell(address); std::string aliasStr; if (cell && cell->getAlias(aliasStr)) @@ -1270,7 +1270,7 @@ void Sheet::insertRows(int row, int count) void Sheet::removeRows(int row, int count) { // Remove aliases, if defined - for (auto address : cells.getRows(row, count)) { + for (const auto &address : cells.getRows(row, count)) { auto cell = getCell(address); std::string aliasStr; if (cell && cell->getAlias(aliasStr)) @@ -1573,7 +1573,7 @@ void Sheet::setCopyOrCutRanges(const std::vector &ranges, bool copy) std::set rangeSet(copyCutRanges.begin(), copyCutRanges.end()); copyCutRanges = ranges; rangeSet.insert(copyCutRanges.begin(), copyCutRanges.end()); - for(auto range : rangeSet) + for(const auto &range : rangeSet) rangeUpdated(range); hasCopyRange = copy; } diff --git a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp index de921805c6..bce7a09483 100644 --- a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp @@ -709,7 +709,7 @@ void SheetTableView::pasteClipboard() return; if(!copy) { - for(auto range : ranges) { + for(auto &range : ranges) { do { sheet->clear(*range); } while (range.next());