Kaydet (Commit) 39380c04 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Avoid unnecessary dereferencing of potential null pointers

That pDoc can be null here and in previous
24065627 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
üst 6292bfc2
......@@ -56,7 +56,7 @@ private:
virtual ~SwXFieldMaster();
SwXFieldMaster(SwFieldType& rType, SwDoc & rDoc);
SwXFieldMaster(SwFieldType& rType, SwDoc * pDoc);
/// descriptor
SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId);
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment