[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Oct 4 13:03:52 UTC 2020
sw/source/uibase/uno/unodefaults.cxx | 25 ++++++++++---------------
sw/source/uibase/uno/unodefaults.hxx | 4 ++--
sw/source/uibase/uno/unotxdoc.cxx | 2 +-
3 files changed, 13 insertions(+), 18 deletions(-)
New commits:
commit 3dee30f1c033d3679f7b8dbc7813b7dc03ac8f70
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 2 20:11:38 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 4 15:03:13 2020 +0200
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 at redhat.com>
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
More information about the Libreoffice-commits
mailing list