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

Stephan Bergmann sbergman at redhat.com
Mon Aug 25 06:30:04 PDT 2014


 sw/source/core/inc/unofield.hxx     |    2 +-
 sw/source/core/unocore/unofield.cxx |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 39380c04a5de4b56da566c139944b387a4ec133a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Aug 25 15:26:54 2014 +0200

    Avoid unnecessary dereferencing of potential null pointers
    
    That pDoc can be null here and in previous
    2406562733f62b96dd8e6537e1bf4bef147ef50c is somewhat fishy, but probably related
    to "NOTE: the sw.SwXAutoTextEntry unoapi test depends on pDoc = 0" from
    "fdo#72695: avoid double-free race condition for SwXTextField."  As mstahl puts
    it: "hmm... theres some stupid unoapi test that inserts a field into an
    SwXAutoTextEntry which is a horribly odd class that doesn't have any way of
    creating SwXanything of its own SwDoc... so probably your commit is required
    after all."
    
    Change-Id: I2da77e1180e205eca274ce0330ee2a4d5aab29ac

diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index fb8582c..78415a4 100644
--- a/sw/source/core/inc/unofield.hxx
+++ b/sw/source/core/inc/unofield.hxx
@@ -56,7 +56,7 @@ private:
 
     virtual ~SwXFieldMaster();
 
-    SwXFieldMaster(SwFieldType& rType, SwDoc & rDoc);
+    SwXFieldMaster(SwFieldType& rType, SwDoc * pDoc);
 
     /// descriptor
     SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId);
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 70efab2..e59fd8d 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -435,10 +435,10 @@ public:
     sal_Int32       m_nParam2;
 
     Impl(SwModify *const pModify,
-            SwDoc & rDoc, sal_uInt16 const nResId, bool const bIsDescriptor)
+            SwDoc * pDoc, sal_uInt16 const nResId, bool const bIsDescriptor)
         : SwClient(pModify)
         , m_EventListeners(m_Mutex)
-        , m_pDoc(& rDoc)
+        , m_pDoc(pDoc)
         , m_bIsDescriptor(bIsDescriptor)
         , m_nResTypeId(nResId)
         , m_fParam1(0.0)
@@ -526,12 +526,12 @@ SwXFieldMaster::getSupportedServiceNames() throw (uno::RuntimeException, std::ex
 
 SwXFieldMaster::SwXFieldMaster(SwDoc *const pDoc, sal_uInt16 const nResId)
     : m_pImpl(new Impl(pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD),
-                *pDoc, nResId, true))
+                pDoc, nResId, true))
 {
 }
 
-SwXFieldMaster::SwXFieldMaster(SwFieldType& rType, SwDoc & rDoc)
-    : m_pImpl(new Impl(&rType, rDoc, rType.Which(), false))
+SwXFieldMaster::SwXFieldMaster(SwFieldType& rType, SwDoc * pDoc)
+    : m_pImpl(new Impl(&rType, pDoc, rType.Which(), false))
 {
 }
 
@@ -552,7 +552,7 @@ SwXFieldMaster::CreateXFieldMaster(SwDoc * pDoc, SwFieldType *const pType,
     if (!xFM.is())
     {
         SwXFieldMaster *const pFM( (pType)
-                ? new SwXFieldMaster(*pType, *pDoc)
+                ? new SwXFieldMaster(*pType, pDoc)
                 : new SwXFieldMaster(pDoc, nResId));
         xFM.set(pFM);
         if (pType)


More information about the Libreoffice-commits mailing list