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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Feb 11 06:08:46 UTC 2019


 chart2/source/controller/drawinglayer/ViewElementListProvider.cxx |   30 +++++-----
 sfx2/source/view/viewfrm.cxx                                      |   11 +--
 2 files changed, 20 insertions(+), 21 deletions(-)

New commits:
commit 04c1a98c10a24e65c4460d198c4009dc512c44ab
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Feb 8 14:57:36 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Feb 11 07:08:38 2019 +0100

    tdf#120703 PVS: V560 A part of conditional expression is always true
    
    Change-Id: I598ba9c49e919c3a521b3062c83b72a1c7949b9e
    Reviewed-on: https://gerrit.libreoffice.org/67540
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 049307823e24..1d8273bffb97 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -969,7 +969,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet )
          pShUndoMgr->GetRepeatActionCount() == 0 )
         rSet.DisableItem( SID_CLEARHISTORY );
 
-    if ( pShUndoMgr && pShUndoMgr->GetUndoActionCount() )
+    if (pShUndoMgr->GetUndoActionCount())
     {
         const SfxUndoAction* pAction = pShUndoMgr->GetUndoAction();
         SfxViewShell *pViewSh = GetViewShell();
@@ -985,7 +985,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet )
     else
         rSet.DisableItem( SID_UNDO );
 
-    if ( pShUndoMgr && pShUndoMgr->GetRedoActionCount() )
+    if (pShUndoMgr->GetRedoActionCount())
     {
         const SfxUndoAction* pAction = pShUndoMgr->GetRedoAction();
         SfxViewShell *pViewSh = GetViewShell();
@@ -1002,7 +1002,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet )
         rSet.DisableItem( SID_REDO );
 
     SfxRepeatTarget *pTarget = pSh->GetRepeatTarget();
-    if ( pShUndoMgr && pTarget && pShUndoMgr->GetRepeatActionCount() && pShUndoMgr->CanRepeat(*pTarget) )
+    if (pTarget && pShUndoMgr->GetRepeatActionCount() && pShUndoMgr->CanRepeat(*pTarget))
         rSet.Put( SfxStringItem( SID_REPEAT, SvtResId(STR_REPEAT)+pShUndoMgr->GetRepeatActionComment(*pTarget) ) );
     else
         rSet.DisableItem( SID_REPEAT );
@@ -2208,10 +2208,9 @@ void SfxViewFrame::ExecView_Impl
         {
             const SfxInt16Item* pItem = rReq.GetArg<SfxInt16Item>(SID_OBJECT);
 
-            SfxViewShell *pViewShell = GetViewShell();
-            if ( pViewShell && pItem )
+            if (pItem)
             {
-                pViewShell->DoVerb( pItem->GetValue() );
+                GetViewShell()->DoVerb( pItem->GetValue() );
                 rReq.Done();
                 break;
             }
commit 6fd533031f2775aaa8843065a9986caf1fa304b0
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Feb 7 15:04:16 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Feb 11 07:08:24 2019 +0100

    tdf#120703 PVS: remove obsolete check (leftover from static removal)
    
    V560 A part of conditional expression is always true: !pSymbolList.
    
    In commit a2cd17d19085d739b979445d7f9ec7158b89df49, pSymbolList and
    xSymbols were made non-static. The check below was left though.
    
    Actually, I don't know if that was a safe move, since it's unclear
    how the lifetime of the returned pointer is managed now to prevent
    use-after-free.
    
    Change-Id: Ia51a9790503694f909ce7953337d3caaebfabfc1
    Reviewed-on: https://gerrit.libreoffice.org/67512
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index 94660e734890..52b122f909c4 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -106,27 +106,27 @@ XPatternListRef   ViewElementListProvider::GetPatternList() const
 SdrObjList* ViewElementListProvider::GetSymbolList() const
 {
     SdrObjList* pSymbolList = nullptr;
-    uno::Reference< drawing::XShapes > xSymbols;//@todo this keeps the first drawinglayer alive ...
     try
     {
-        if(!pSymbolList || !pSymbolList->GetObjCount())
-        {
-            //@todo use mutex
+        //@todo use mutex
 
-            //get shape factory
-            uno::Reference< lang::XMultiServiceFactory > xShapeFactory( m_pDrawModelWrapper->getShapeFactory() );
+        //get shape factory
+        uno::Reference<lang::XMultiServiceFactory> xShapeFactory(
+            m_pDrawModelWrapper->getShapeFactory());
 
-            //get hidden draw page (target):
-            uno::Reference<drawing::XShapes> xTarget( m_pDrawModelWrapper->getHiddenDrawPage(), uno::UNO_QUERY );
+        //get hidden draw page (target):
+        uno::Reference<drawing::XShapes> xTarget(m_pDrawModelWrapper->getHiddenDrawPage(),
+                                                 uno::UNO_QUERY);
 
-            //create symbols via uno and convert to native sdr objects
-            drawing::Direction3D aSymbolSize(220,220,0); // should be 250, but 250 -> 280 ??
-            xSymbols =  DataPointSymbolSupplier::create2DSymbolList( xShapeFactory, xTarget, aSymbolSize );
+        //create symbols via uno and convert to native sdr objects
+        drawing::Direction3D aSymbolSize(220, 220, 0); // should be 250, but 250 -> 280 ??
+        uno::Reference<drawing::XShapes> xSymbols
+            = DataPointSymbolSupplier::create2DSymbolList(xShapeFactory, xTarget, aSymbolSize);
 
-            SdrObject* pSdrObject = DrawViewWrapper::getSdrObject( uno::Reference< drawing::XShape >( xSymbols, uno::UNO_QUERY ) );
-            if(pSdrObject)
-                pSymbolList = pSdrObject->GetSubList();
-        }
+        SdrObject* pSdrObject = DrawViewWrapper::getSdrObject(
+            uno::Reference<drawing::XShape>(xSymbols, uno::UNO_QUERY));
+        if (pSdrObject)
+            pSymbolList = pSdrObject->GetSubList();
     }
     catch( const uno::Exception& e )
     {


More information about the Libreoffice-commits mailing list