diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-10-02 20:11:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-10-04 15:03:13 +0200 |
commit | 3dee30f1c033d3679f7b8dbc7813b7dc03ac8f70 (patch) | |
tree | 361cddccf25759634d3ab0c2f4b446ed4ffbcf12 | |
parent | f5198863fc115eb72853ed76dfef037001784b61 (diff) |
SwSvxUnoDrawPool ctor never passed a null SwDoc*
which is always dereferenced and never changes. so m_pDoc can
never be null so delete that redundant condition
Change-Id: I4fde5f3f8f0ffcc790d1c8f16a8ab05a842eed06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103876
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/uibase/uno/unodefaults.cxx | 25 | ||||
-rw-r--r-- | sw/source/uibase/uno/unodefaults.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 2 |
3 files changed, 13 insertions, 18 deletions
diff --git a/sw/source/uibase/uno/unodefaults.cxx b/sw/source/uibase/uno/unodefaults.cxx index 6daaeee4edc1..135bf88e80ec 100644 --- a/sw/source/uibase/uno/unodefaults.cxx +++ b/sw/source/uibase/uno/unodefaults.cxx @@ -23,9 +23,9 @@ #include <doc.hxx> #include <IDocumentDrawModelAccess.hxx> -SwSvxUnoDrawPool::SwSvxUnoDrawPool(SwDoc* pDoc) - : SvxUnoDrawPool(pDoc->getIDocumentDrawModelAccess().GetDrawModel(), SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER) - , m_pDoc(pDoc) +SwSvxUnoDrawPool::SwSvxUnoDrawPool(SwDoc& rDoc) + : SvxUnoDrawPool(rDoc.getIDocumentDrawModelAccess().GetDrawModel(), SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER) + , m_rDoc(rDoc) { } @@ -35,18 +35,13 @@ SwSvxUnoDrawPool::~SwSvxUnoDrawPool() throw() SfxItemPool* SwSvxUnoDrawPool::getModelPool( bool /*bReadOnly*/ ) throw() { - if(m_pDoc) - { - - // DVO, OD 01.10.2003 #i18732# - return item pool of writer document; - // it contains draw model item pool as secondary pool. - //SdrModel* pModel = m_pDoc->MakeDrawModel(); - //return &pModel->GetItemPool(); - // #i52858# - method name changed - m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); - return &(m_pDoc->GetAttrPool()); - } - return nullptr; + // DVO, OD 01.10.2003 #i18732# - return item pool of writer document; + // it contains draw model item pool as secondary pool. + //SdrModel* pModel = m_rDoc.MakeDrawModel(); + //return &pModel->GetItemPool(); + // #i52858# - method name changed + m_rDoc.getIDocumentDrawModelAccess().GetOrCreateDrawModel(); + return &(m_rDoc.GetAttrPool()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uno/unodefaults.hxx b/sw/source/uibase/uno/unodefaults.hxx index 23bd6b543e10..ba218940b6d0 100644 --- a/sw/source/uibase/uno/unodefaults.hxx +++ b/sw/source/uibase/uno/unodefaults.hxx @@ -25,9 +25,9 @@ class SwDoc; class SwSvxUnoDrawPool : public SvxUnoDrawPool { - SwDoc* m_pDoc; + SwDoc& m_rDoc; public: - SwSvxUnoDrawPool(SwDoc* pDoc); + SwSvxUnoDrawPool(SwDoc& rDoc); virtual ~SwSvxUnoDrawPool() throw() override; virtual SfxItemPool* getModelPool( bool bReadOnly ) throw() override; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 7208fd2d94ca..31f7cf31c68a 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -4356,7 +4356,7 @@ Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(SwCreateDrawTable break; case SwCreateDrawTable::Defaults: if(!xDrawDefaults.is()) - xDrawDefaults = static_cast<cppu::OWeakObject*>(new SwSvxUnoDrawPool(m_pDoc)); + xDrawDefaults = static_cast<cppu::OWeakObject*>(new SwSvxUnoDrawPool(*m_pDoc)); xRet = xDrawDefaults; break; #if OSL_DEBUG_LEVEL > 0 |