From 3e59716375a240576fd6d8759b32b4319506ed70 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 12 Dec 2019 16:42:42 +0100 Subject: Prevent BroadcastRecalcOnRefMoveHandler copies ...which would contain copies of AutoCalcSwitch and ScBulkBroadcast that both do things in their dtors. std::sort (into which BroadcastRecalcOnRefMoveHandler is passed as function object argument) returns its function object argument, which caused the BroadcastRecalcOnRefMoveHandler copies. Better split the RAII part that holds AutoCalcSwitch and ScBulkBroadcast and does things in their dtors into a BroadcastRecalcOnRefMoveGuard class of its own. (And while at it, explicitly delete the copy/move functions of AutoCalcSwitch and ScBulkBroadcast to avoid such issues in the future.) (The RAII part of BroadcastRecalcOnRefMoveHandler had been added with 60d0b992ea3a910be79ae4a8e8b0bb32a358b18a "sc-perf: tdf#87101 add bulk scope for BroadcastRecalcOnRefMove() calls". The issue was found with Clang 10 trunk -Wdeprecated-copy-dtor.) Change-Id: I45d6b81e7c8b34aed57b6f66c5e1e966a43a565d Reviewed-on: https://gerrit.libreoffice.org/85063 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sc/inc/scopetools.hxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sc/inc/scopetools.hxx') diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx index 571b1fce52f5..b71154330e96 100644 --- a/sc/inc/scopetools.hxx +++ b/sc/inc/scopetools.hxx @@ -24,6 +24,12 @@ class SC_DLLPUBLIC AutoCalcSwitch { ScDocument& mrDoc; bool const mbOldValue; + + AutoCalcSwitch(AutoCalcSwitch const &) = delete; + AutoCalcSwitch(AutoCalcSwitch &&) = delete; + AutoCalcSwitch & operator =(AutoCalcSwitch const &) = delete; + AutoCalcSwitch & operator =(AutoCalcSwitch &&) = delete; + public: AutoCalcSwitch(ScDocument& rDoc, bool bAutoCalc); ~AutoCalcSwitch(); -- cgit