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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 12 20:53:45 UTC 2019


 sw/source/uibase/shells/tabsh.cxx |    8 +++++---
 sw/source/uibase/uiview/view.cxx  |   24 ++++++++++++++++++------
 2 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 52d87ec0046d002ee67482671ad67bf5b9b4268b
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Aug 10 17:14:50 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Aug 12 22:52:17 2019 +0200

    sw: Immediately construct a shared_ptr instead of raw pointer
    
    Change-Id: Id6e212ae143133ea1899c585f18986c02bf3a58d
    Reviewed-on: https://gerrit.libreoffice.org/77363
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index b36d1b65fb4c..4a37848da7a7 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -138,8 +138,10 @@ static void lcl_SetAttr( SwWrtShell &rSh, const SfxPoolItem &rItem )
     rSh.SetTableAttr( aSet );
 }
 
-static SwTableRep*  lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
+static std::shared_ptr<SwTableRep> lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
 {
+    std::shared_ptr<SwTableRep> pRep;
+
     SwFrameFormat *pFormat = rSh.GetTableFormat();
     SwTabCols aCols;
     rSh.GetTabCols( aCols );
@@ -220,7 +222,7 @@ static SwTableRep*  lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
     rSh.GetTabCols( aTabCols );
 
     // Pointer will be deleted after the dialogue execution.
-    SwTableRep* pRep = new SwTableRep( aTabCols );
+    pRep = std::make_shared<SwTableRep>(aTabCols);
     pRep->SetSpace(aCols.GetRightMax());
 
     sal_uInt16 nPercent = 0;
@@ -266,7 +268,7 @@ static SwTableRep*  lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
     pRep->SetWidthPercent(nPercent);
     // Are individual rows / cells are selected, the column processing will be changed.
     pRep->SetLineSelected(bTableSel && ! rSh.HasWholeTabSelection());
-    rSet.Put(SwPtrItem(FN_TABLE_REP, pRep));
+    rSet.Put(SwPtrItem(FN_TABLE_REP, pRep.get()));
     return pRep;
 }
 
commit 6d6671b1779a74f35d29a68dd4802afdf7c6a5c1
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Aug 10 17:13:04 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Aug 12 22:51:57 2019 +0200

    sw: properly initialize the instance variables
    
    Change-Id: Id12dcebe12540302e32a54e6c62b6773f6695e0c
    Reviewed-on: https://gerrit.libreoffice.org/77362
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 79cee5d94399..deeaf1003da2 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -744,10 +744,27 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     m_nRightBorderDistance( 0 ),
     m_eLastSearchCommand( static_cast<SvxSearchCmd>(0xFFFF) ),
     m_bWheelScrollInProgress(false),
+    m_bCenterCursor(false),
+    m_bTopCursor(false),
+    m_bTabColFromDoc(false),
+    m_bTabRowFromDoc(false),
+    m_bSetTabColFromDoc(false),
+    m_bSetTabRowFromDoc(false),
+    m_bAttrChgNotified(false),
+    m_bAttrChgNotifiedWithRegistrations(false),
+    m_bVerbsActive(false),
+    m_bDrawRotate(false),
+    m_bDrawSelMode(true),
+    m_bShowAtResize(true),
+    m_bInOuterResizePixel(false),
+    m_bInInnerResizePixel(false),
+    m_bPasteState(false),
+    m_bPasteSpecialState(false),
     m_bInMailMerge(false),
     m_bInDtor(false),
     m_bOldShellWasPagePreview(false),
     m_bIsPreviewDoubleClick(false),
+    m_bMakeSelectionVisible(false),
     m_nLOKPageUpDownOffset(0)
 {
     static bool bRequestDoubleBuffering = getenv("VCL_DOUBLEBUFFERING_ENABLE");
@@ -761,12 +778,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     // If the view is switch from one to another, the 'old' view is given by
     // parameter <pOldSh>.
 
-    m_bCenterCursor = m_bTopCursor = m_bTabColFromDoc = m_bTabRowFromDoc =
-    m_bSetTabColFromDoc = m_bSetTabRowFromDoc = m_bAttrChgNotified = m_bAttrChgNotifiedWithRegistrations =
-    m_bVerbsActive = m_bDrawRotate = m_bInOuterResizePixel = m_bInInnerResizePixel =
-    m_bPasteState = m_bPasteSpecialState = m_bMakeSelectionVisible = false;
-
-    m_bShowAtResize = m_bDrawSelMode = bDocSzUpdated = true;
+    bDocSzUpdated = true;
 
     CreateScrollbar( true );
     CreateScrollbar( false );


More information about the Libreoffice-commits mailing list