summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/rangenam.hxx2
-rw-r--r--sc/source/core/tool/rangenam.cxx1
2 files changed, 2 insertions, 1 deletions
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 0e8de43fc025..ce0e2082e999 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -222,7 +222,7 @@ public:
SC_DLLPUBLIC size_t size() const;
bool empty() const;
- /** Insert object into set if not a duplicate.
+ /** Insert object into set.
@ATTENTION: The underlying ::boost::ptr_set_adapter::insert(p) takes
ownership of p and if it can't insert it deletes the object! So, if
this insert here returns false the object where p pointed to is gone!
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 8ebcc7655485..214c17b06f80 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -894,6 +894,7 @@ bool ScRangeName::insert(ScRangeData* p)
}
rtl::OUString aName(p->GetUpperName());
+ maData.erase(aName); // ptr_map won't insert it if a duplicate name exists.
pair<DataType::iterator, bool> r = maData.insert(aName, p);
if (r.second)
{