diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-08-25 15:26:54 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-08-25 15:26:59 +0200 |
commit | 39380c04a5de4b56da566c139944b387a4ec133a (patch) | |
tree | 7b6d204e69b75eaac20f2b54a134e4f5f0940e5f /sw/source/core/unocore/unofield.cxx | |
parent | 6292bfc282c56ec4a9098989957c4cdfc6ef1e0f (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
Diffstat (limited to 'sw/source/core/unocore/unofield.cxx')
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
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) |