[Libreoffice-commits] core.git: sw/inc sw/qa sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Oct 4 13:04:37 UTC 2020


 sw/inc/docsh.hxx                     |    2 +-
 sw/qa/core/macros-test.cxx           |    2 +-
 sw/qa/core/uwriter.cxx               |    2 +-
 sw/source/core/doc/docnew.cxx        |    2 +-
 sw/source/core/ole/ndole.cxx         |    6 +++---
 sw/source/uibase/app/docsh2.cxx      |    2 +-
 sw/source/uibase/app/docshini.cxx    |    4 ++--
 sw/source/uibase/dochdl/swdtflvr.cxx |    4 ++--
 sw/source/uibase/uno/unotxvw.cxx     |    2 +-
 9 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit fd7b0c9e64e32640bde911a71d6f17dd3e4268ec
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 3 18:57:20 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 4 15:03:54 2020 +0200

    the SwDocShell(SwDoc*, ...) variant is never passed a null SwDoc*
    
    Change-Id: I4b492f46a6c017746fa2665f677f5a39519c3614
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103905
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 6dc7fdf21f35..d58a3fdb9844 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -177,7 +177,7 @@ public:
     /// Doc is required for SO data exchange!
     SwDocShell( SfxObjectCreateMode eMode = SfxObjectCreateMode::EMBEDDED );
     SwDocShell( SfxModelFlags i_nSfxCreationFlags );
-    SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode );
+    SwDocShell( SwDoc& rDoc, SfxObjectCreateMode eMode );
     virtual ~SwDocShell() override;
 
     /// OLE 2.0-notification.
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 8bfcb884a2ac..f85d56342207 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -311,7 +311,7 @@ void SwMacrosTest::testControlShapeGrouping()
 void SwMacrosTest::testFdo55289()
 {
     SwDoc *const pDoc = new SwDoc;
-    SwDocShellRef pDocShell = new SwDocShell(pDoc, SfxObjectCreateMode::EMBEDDED);
+    SwDocShellRef pDocShell = new SwDocShell(*pDoc, SfxObjectCreateMode::EMBEDDED);
     // this needs to run with no layout to tickle the bugs in the special
     // cases in SwXShape re-anchoring
     assert(!pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index a2b5e99e079b..0d49a0744f33 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -2113,7 +2113,7 @@ void SwDocTest::setUp()
 
     SwGlobals::ensure();
     m_pDoc = new SwDoc;
-    m_xDocShRef = new SwDocShell(m_pDoc, SfxObjectCreateMode::EMBEDDED);
+    m_xDocShRef = new SwDocShell(*m_pDoc, SfxObjectCreateMode::EMBEDDED);
     m_xDocShRef->DoInitNew();
 }
 
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 6bad04a7180c..54c576830b15 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -889,7 +889,7 @@ SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const
     // we have to use pointer here, since the callee has to decide whether
     // SfxObjectShellLock or SfxObjectShellRef should be used sometimes the
     // object will be returned with refcount set to 0 ( if no DoInitNew is done )
-    SfxObjectShell* pRetShell = new SwDocShell( xRet.get(), SfxObjectCreateMode::STANDARD );
+    SfxObjectShell* pRetShell = new SwDocShell( *xRet, SfxObjectCreateMode::STANDARD );
     if( bCallInitNew )
     {
         // it could happen that DoInitNew creates model,
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index e02c8fc23f43..74ceed65d2e0 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -261,7 +261,7 @@ bool SwOLENode::RestorePersistentData()
             // TODO/LATER: Isn't an EmbeddedObjectContainer sufficient here?
             // What happens to this document?
             OSL_ENSURE( false, "Why are we creating a DocShell here?" );
-            p = new SwDocShell( &GetDoc(), SfxObjectCreateMode::INTERNAL );
+            p = new SwDocShell( GetDoc(), SfxObjectCreateMode::INTERNAL );
             p->DoInitNew();
         }
 
@@ -431,7 +431,7 @@ SwContentNode* SwOLENode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx, bool)
     {
         // TODO/LATER: is EmbeddedObjectContainer not enough?
         // the created document will be closed by rDoc ( should use SfxObjectShellLock )
-        pPersistShell = new SwDocShell( &rDoc, SfxObjectCreateMode::INTERNAL );
+        pPersistShell = new SwDocShell( rDoc, SfxObjectCreateMode::INTERNAL );
         rDoc.SetTmpDocShell( pPersistShell );
         pPersistShell->DoInitNew();
     }
@@ -874,7 +874,7 @@ void SwOLEObj::SetNode( SwOLENode* pNode )
         // TODO/LATER: Isn't an EmbeddedObjectContainer sufficient here?
         // What happens to the document?
         OSL_ENSURE( false, "Why are we creating a DocShell here??" );
-        p = new SwDocShell( &rDoc, SfxObjectCreateMode::INTERNAL );
+        p = new SwDocShell( rDoc, SfxObjectCreateMode::INTERNAL );
         p->DoInitNew();
     }
 
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index fbabf863490d..479eed290aad 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -752,7 +752,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
                 sal_uInt8 nLevel = pDlg->GetLevel();
                 sal_uInt8 nPara = pDlg->GetPara();
                 SwDoc* pSmryDoc = new SwDoc();
-                SfxObjectShellLock xDocSh( new SwDocShell( pSmryDoc, SfxObjectCreateMode::STANDARD));
+                SfxObjectShellLock xDocSh(new SwDocShell(*pSmryDoc, SfxObjectCreateMode::STANDARD));
                 xDocSh->DoInitNew();
 
                 bool bImpress = FN_ABSTRACT_STARIMPRESS == nWhich;
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 0cfea4721e42..f4aadf7476ca 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -338,9 +338,9 @@ SwDocShell::SwDocShell( const SfxModelFlags i_nSfxCreationFlags )
 }
 
 // Ctor / Dtor
-SwDocShell::SwDocShell( SwDoc *const pD, SfxObjectCreateMode const eMode )
+SwDocShell::SwDocShell( SwDoc& rD, SfxObjectCreateMode const eMode )
     : SfxObjectShell(eMode)
-    , m_xDoc(pD)
+    , m_xDoc(&rD)
     , m_IsInUpdateFontList(false)
     , m_pStyleManager(new svx::CommonStyleManager(*this))
     , m_pView(nullptr)
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 44127a51f6f4..47027b764e1e 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -657,7 +657,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
             if( !m_aDocShellRef.Is() )
             {
                 SwDoc& rDoc = lcl_GetDoc(*m_pClpDocFac);
-                SwDocShell* pNewDocSh = new SwDocShell( &rDoc,
+                SwDocShell* pNewDocSh = new SwDocShell( rDoc,
                                          SfxObjectCreateMode::EMBEDDED );
                 m_aDocShellRef = pNewDocSh;
                 m_aDocShellRef->DoInitNew();
@@ -918,7 +918,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
     {
         m_pClpDocFac.reset(new SwDocFac);
         SwDoc& rDoc = lcl_GetDoc(*m_pClpDocFac);
-        m_aDocShellRef = new SwDocShell( &rDoc, SfxObjectCreateMode::EMBEDDED);
+        m_aDocShellRef = new SwDocShell(rDoc, SfxObjectCreateMode::EMBEDDED);
         m_aDocShellRef->DoInitNew();
         m_pWrtShell->Copy(&rDoc);
 
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 6d7a1976a57a..97317e9ed67c 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -645,7 +645,7 @@ SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc()
     SwWrtShell& rOldSh = m_pView->GetWrtShell();
     SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess().getPrinter( false );
     SwDocShell* pDocSh;
-    SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SfxObjectCreateMode::STANDARD ) );
+    SfxObjectShellLock xDocSh( pDocSh = new SwDocShell(SfxObjectCreateMode::STANDARD) );
     xDocSh->DoInitNew();
     SwDoc *const pTempDoc( pDocSh->GetDoc() );
     // #i103634#, #i112425#: do not expand numbering and fields on PDF export


More information about the Libreoffice-commits mailing list