diff options
author | Eike Rathke <erack@redhat.com> | 2021-10-07 18:02:23 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-10-11 11:28:35 +0200 |
commit | 333b77e92b502d3c3f886f1b38b2e528a2f0937c (patch) | |
tree | f466c0f2762c4e2b2fa48248fa3cf7394541e4a9 /sc/inc | |
parent | c3c31ab91c6e3650a881594bf52297947eefa5e2 (diff) |
Blind fix crash in ScDBData::UpdateReference(), tdf#126926 follow-up
Crash reports at
https://crashreport.libreoffice.org/stats/signature/ScDBData::UpdateReference(ScDocument%20const%20*,UpdateRefMode,short,long,short,short,long,short,short,long,short)
No reproducer yet, for a possible reproducer see
https://bugs.documentfoundation.org/show_bug.cgi?id=126926#c12
but creating such a scenario with 8 AutoFilters / sheets wasn't
sufficient.
However, ScDBCollection::NamedDBs (maNamedDBs) uses a std::set so after
erase(iterator++) iterator is still valid, but ScDBCollection::AnonDBs
maAnonDBs uses a std::vector for which after erase(iterator++) iterator
may be invalid if vector was shrunk and reallocated.
So use the iterator returning erase() instead to have a valid following
iterator, and for consistency do that for both.
A reproducer may need a bunch of sheets / anonymous AutoFilter for a
vector to shrink and be reallocated, and it may depend on the
plattform/compiler's implementation.
Change-Id: Ib57294d8af9f486b734f4294d8d310ce0fa20551
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123224
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 9a0d52c95b6fd8639a56df2c2ceff07277253183)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123160
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/dbdata.hxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index 8ecd2faf602f..4f328ce88a6a 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -263,7 +263,7 @@ public: */ bool insert(std::unique_ptr<ScDBData> p); - void erase(const iterator& itr); + iterator erase(const iterator& itr); bool empty() const; size_t size() const; bool operator== (const NamedDBs& r) const; @@ -295,7 +295,7 @@ public: void deleteOnTab(SCTAB nTab); ScDBData* getByRange(const ScRange& rRange); void insert(ScDBData* p); - void erase(const iterator& itr); + iterator erase(const iterator& itr); bool empty() const; bool has( const ScDBData* p ) const; bool operator== (const AnonDBs& r) const; |