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

Lionel Elie Mamane lionel at mamane.lu
Thu Sep 17 10:36:28 PDT 2015


 dbaccess/source/core/api/RowSetCache.cxx |    3 ++-
 svx/source/fmcomp/gridcell.cxx           |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 558b08d55f69b04eea42a37abd97fbb4dbe3602f
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Sep 17 19:31:35 2015 +0200

    silence warning when not a warning
    
    Change-Id: I31d7835a5ed3053cd1a930b3fb922d689d6ddcbe

diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index ed838ed..fe21eae 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -741,7 +741,8 @@ bool ORowSetCache::afterLast(  )
 
 bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos, sal_Int32 &_nNewEndPos)
 {
-    OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!");
+    OSL_ENSURE((_nNewStartPos != _nNewEndPos) || (_nNewStartPos == 0 && _nNewEndPos == 0 && m_nRowCount == 0),
+               "ORowSetCache::fillMatrix: StartPos and EndPos can not be equal (unless the recordset is empty)!");
     // If _nNewStartPos >= 0, then fill the whole window with new data
     // Else if _nNewStartPos == -1, then fill only segment [m_nEndPos, _nNewEndPos)
     // Else, undefined (invalid argument)
commit a4677e8d868840ade21d74938c29ccdf75e9c666
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Sep 17 19:24:04 2015 +0200

    make FmXGridCell more disposed-safe
    
    fixes a segfault (crash) in these conditions:
    
    * the form's AfterInsert StarBasic script does a reload() of the form
    
    * the insert happens by clicking into a cell which has
      scripts linked to the events FocusLost and FocusGained.
      The case that led to discovering this involved a ListBox whose
      RecordSource changes when focus is gained or lost.
    
    Then there was a race condition between the cell's dispose (from the
    form's reload()) and the _old_ cell's FocusLost being executed.
    NewStyleUNOScript::invoke would then call
    xControl->getModel
    with xControl being the involved cell,
    leading FmXGridCell::getModel() to call m_pColumn->getModel()
    with m_pColumn == NULL.
    
    Change-Id: Ifb4402d37ee4faec80087ffccabe102acc016d60

diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 934be2e..04b8c2b 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3254,6 +3254,7 @@ Reference< XInterface >  FmXGridCell::getContext() throw( RuntimeException, std:
 
 Reference< ::com::sun::star::awt::XControlModel >  FmXGridCell::getModel() throw( ::com::sun::star::uno::RuntimeException, std::exception )
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     return Reference< ::com::sun::star::awt::XControlModel > (m_pColumn->getModel(), UNO_QUERY);
 }
 
@@ -3261,12 +3262,14 @@ Reference< ::com::sun::star::awt::XControlModel >  FmXGridCell::getModel() throw
 
 sal_Bool FmXGridCell::getLock() throw( RuntimeException, std::exception )
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     return m_pColumn->isLocked();
 }
 
 
 void FmXGridCell::setLock(sal_Bool _bLock) throw( RuntimeException, std::exception )
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     if (getLock() == _bLock)
         return;
     else
@@ -3321,60 +3324,70 @@ void SAL_CALL FmXGridCell::setFocus(  ) throw (RuntimeException, std::exception)
 
 void SAL_CALL FmXGridCell::addWindowListener( const Reference< awt::XWindowListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aWindowListeners.addInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::removeWindowListener( const Reference< awt::XWindowListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aWindowListeners.removeInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::addFocusListener( const Reference< awt::XFocusListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aFocusListeners.addInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::removeFocusListener( const Reference< awt::XFocusListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aFocusListeners.removeInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::addKeyListener( const Reference< awt::XKeyListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aKeyListeners.addInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::removeKeyListener( const Reference< awt::XKeyListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aKeyListeners.removeInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::addMouseListener( const Reference< awt::XMouseListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aMouseListeners.addInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::removeMouseListener( const Reference< awt::XMouseListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aMouseListeners.removeInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::addMouseMotionListener( const Reference< awt::XMouseMotionListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aMouseMotionListeners.addInterface( _rxListener );
 }
 
 
 void SAL_CALL FmXGridCell::removeMouseMotionListener( const Reference< awt::XMouseMotionListener >& _rxListener ) throw (RuntimeException, std::exception)
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aMouseMotionListeners.removeInterface( _rxListener );
 }
 
@@ -3404,12 +3417,14 @@ IMPL_LINK( FmXGridCell, OnWindowEvent, VclWindowEvent*, _pEvent )
 
 void FmXGridCell::onFocusGained( const awt::FocusEvent& _rEvent )
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aFocusListeners.notifyEach( &awt::XFocusListener::focusGained, _rEvent );
 }
 
 
 void FmXGridCell::onFocusLost( const awt::FocusEvent& _rEvent )
 {
+    checkDisposed(OComponentHelper::rBHelper.bDisposed);
     m_aFocusListeners.notifyEach( &awt::XFocusListener::focusLost, _rEvent );
 }
 


More information about the Libreoffice-commits mailing list