[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jan 20 22:09:11 PST 2012


 sc/inc/rangenam.hxx              |    1 +
 sc/source/core/tool/rangenam.cxx |    9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 8a449369b50db65423d709000891fec25d9dba54
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Sat Jan 21 01:08:32 2012 -0500

    Oops I shouldn't have erased names directly.
    
    We always need to remove the index map when removing a name.

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index ce0e208..53e9ec8 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -230,6 +230,7 @@ public:
     SC_DLLPUBLIC bool insert(ScRangeData* p);
 
     void erase(const ScRangeData& r);
+    void erase(const rtl::OUString& rName);
 
     /**
      * Erase by iterator position.  Note that this method doesn't check for
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 214c17b..ed8b5d3 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -894,7 +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.
+    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)
     {
@@ -909,7 +909,12 @@ bool ScRangeName::insert(ScRangeData* p)
 
 void ScRangeName::erase(const ScRangeData& r)
 {
-    DataType::iterator itr = maData.find(r.GetUpperName());
+    erase(r.GetUpperName());
+}
+
+void ScRangeName::erase(const rtl::OUString& rName)
+{
+    DataType::iterator itr = maData.find(rName);
     if (itr != maData.end())
         erase(itr);
 }


More information about the Libreoffice-commits mailing list