[Libreoffice-commits] .: sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Jan 20 21:11:10 PST 2012
sc/inc/rangenam.hxx | 2 +-
sc/source/core/tool/rangenam.cxx | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 657b3c889ae107d9ccaaab569929a3a1abde3200
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Sat Jan 21 00:08:29 2012 -0500
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.
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 0e8de43..ce0e208 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 0766f00..da92c7c 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)
{
More information about the Libreoffice-commits
mailing list