diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-21 00:08:29 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-21 00:08:29 -0500 |
commit | 4a00c3d74cd2d0d9905224b8f781dcb8d2ff3f1e (patch) | |
tree | 53049ed8ea6c6d1391a0512acb7fd3c5128a945d /sc | |
parent | 43507c9eb49fdc1de2e193eee32326fb226ff170 (diff) |
fdo#44831: Named range should overwrite existing name.
When inserting a new named range, it should overwrite any existing
name if one exists. That was the old behavior in 3.3 prior to my
range name rework, and because of ptr_map not overwriting existing
key, that behavior had changed unintentionally.
Let's revert to the old behavior.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/rangenam.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/rangenam.cxx | 1 |
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) { |