summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-08-25 15:26:54 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-08-25 15:26:59 +0200
commit39380c04a5de4b56da566c139944b387a4ec133a (patch)
tree7b6d204e69b75eaac20f2b54a134e4f5f0940e5f
parent6292bfc282c56ec4a9098989957c4cdfc6ef1e0f (diff)
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
-rw-r--r--sw/source/core/inc/unofield.hxx2
-rw-r--r--sw/source/core/unocore/unofield.cxx12
2 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index fb8582ca579f..78415a49f53a 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 70efab2a9785..e59fd8def0f8 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)