[Libreoffice-commits] core.git: sw/inc sw/source

Stephan Bergmann sbergman at redhat.com
Thu Mar 16 10:59:13 UTC 2017


 sw/inc/swmodule.hxx               |    2 +-
 sw/source/uibase/app/apphdl.cxx   |    1 -
 sw/source/uibase/app/swmodul1.cxx |   16 ++++++++--------
 sw/source/uibase/app/swmodule.cxx |    2 --
 4 files changed, 9 insertions(+), 12 deletions(-)

New commits:
commit 903a5855e2ccbaa4f828a6359ce31340ea56eade
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 16 11:58:39 2017 +0100

    No need for extra heap allocation
    
    Change-Id: Ibc5424873f6cd4e5e4d9ee37823845b14f17c7fb

diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index b124bba088db..a05d90b7c09e 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -96,7 +96,7 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::C
     SwView*             m_pView;
 
     // List of all Redline-authors.
-    std::vector<OUString>* m_pAuthorNames;
+    std::vector<OUString> m_pAuthorNames;
 
     // DictionaryList listener to trigger spellchecking or hyphenation
     css::uno::Reference< css::linguistic2::XLinguServiceEventListener > m_xLinguServiceEventListener;
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 4c791be75347..ef5ac4a90984 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -887,7 +887,6 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
             DELETEZ(m_pNavigationConfig);
             DELETEZ(m_pToolbarConfig);
             DELETEZ(m_pWebToolbarConfig);
-            DELETEZ(m_pAuthorNames);
             DELETEZ(m_pDBConfig);
             if( m_pColorConfig )
             {
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index d3e4374ec5b5..f77d5f8b3553 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -417,12 +417,12 @@ void SwModule::SetRedlineAuthor(const OUString &rAuthor)
 
 OUString SwModule::GetRedlineAuthor(sal_uInt16 nPos)
 {
-    OSL_ENSURE(nPos < m_pAuthorNames->size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
-    while(!(nPos < m_pAuthorNames->size()))
+    OSL_ENSURE(nPos < m_pAuthorNames.size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
+    while(!(nPos < m_pAuthorNames.size()))
     {
         InsertRedlineAuthor("nn");
     }
-    return (*m_pAuthorNames)[nPos];
+    return m_pAuthorNames[nPos];
 }
 
 static ColorData lcl_GetAuthorColor(sal_uInt16 nPos)
@@ -450,9 +450,9 @@ boost::property_tree::ptree lcl_AuthorToJson(const OUString& rAuthor, size_t nIn
 OUString SwModule::GetRedlineAuthorInfo()
 {
     boost::property_tree::ptree aTable;
-    for (size_t nAuthor = 0; nAuthor < m_pAuthorNames->size(); ++nAuthor)
+    for (size_t nAuthor = 0; nAuthor < m_pAuthorNames.size(); ++nAuthor)
     {
-        boost::property_tree::ptree aAuthor = lcl_AuthorToJson((*m_pAuthorNames)[nAuthor], nAuthor);
+        boost::property_tree::ptree aAuthor = lcl_AuthorToJson(m_pAuthorNames[nAuthor], nAuthor);
         aTable.push_back(std::make_pair("", aAuthor));
     }
 
@@ -467,11 +467,11 @@ sal_uInt16 SwModule::InsertRedlineAuthor(const OUString& rAuthor)
 {
     sal_uInt16 nPos = 0;
 
-    while(nPos < m_pAuthorNames->size() && (*m_pAuthorNames)[nPos] != rAuthor)
+    while(nPos < m_pAuthorNames.size() && m_pAuthorNames[nPos] != rAuthor)
         ++nPos;
 
-    if (nPos == m_pAuthorNames->size())
-        m_pAuthorNames->push_back(rAuthor);
+    if (nPos == m_pAuthorNames.size())
+        m_pAuthorNames.push_back(rAuthor);
 
     return nPos;
 }
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index bd574866f7f9..e1d7db7bee15 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -184,8 +184,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
 
     m_pStdFontConfig = new SwStdFontConfig;
 
-    m_pAuthorNames = new std::vector<OUString>;  // All Redlining-Authors
-
     StartListening( *SfxGetpApp() );
 
     if (!utl::ConfigManager::IsAvoidConfig())


More information about the Libreoffice-commits mailing list