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

Caolán McNamara caolanm at redhat.com
Fri Jun 13 02:37:59 PDT 2014


 sw/source/uibase/uiview/pview.cxx   |    2 +-
 sw/source/uibase/uiview/viewmdi.cxx |    6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit d23a57a29eaed45e15d9b42a83b3c75a2d3b308f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 13 10:34:38 2014 +0100

    coverity#1213307 Dereference before null check
    
    I can see nowhere that m_pHScrollbar or m_pVScrollbar are
    set to NULL, deleted yes in the dtor, but nowhere NULLed.
    
    Change-Id: I3012be6de1117757237884deebacc9e0e29dc7a7

diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 754de84..b0016df 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1244,7 +1244,7 @@ int SwPagePreview::_CreateScrollbar( bool bHori )
     Window *pMDI = &GetViewFrame()->GetWindow();
     SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar;
 
-    OSL_ENSURE( !*ppScrollbar, "check beforehand!" );
+    assert(!*ppScrollbar); //check beforehand!
 
     *ppScrollbar = new SwScrollbar( pMDI, bHori );
 
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index b18ef33..ed80e0b 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -290,7 +290,7 @@ int SwView::_CreateScrollbar( bool bHori )
     Window *pMDI = &GetViewFrame()->GetWindow();
     SwScrollbar** ppScrollbar = bHori ? &m_pHScrollbar : &m_pVScrollbar;
 
-    OSL_ENSURE( !*ppScrollbar, "check beforehand!" );
+    assert(!*ppScrollbar); //check beforehand!
 
     *ppScrollbar = new SwScrollbar( pMDI, bHori );
     UpdateScrollbars();
@@ -305,9 +305,7 @@ int SwView::_CreateScrollbar( bool bHori )
     if(GetWindow())
         InvalidateBorder();
 
-    // The scrollbar has to be tested again, as in InvalidateBorder possibly
-    // the scrollbar has been deleted.
-    if ( !m_bShowAtResize && (*ppScrollbar))
+    if (!m_bShowAtResize)
         (*ppScrollbar)->ExtendedShow();
 
     return 1;


More information about the Libreoffice-commits mailing list