[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - svx/source

Lionel Elie Mamane lionel at mamane.lu
Wed Sep 23 00:35:31 PDT 2015


 svx/source/fmcomp/gridcell.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 6f3824673c6b0d360dd3bbeed7aa3b6c33135aea
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
    Reviewed-on: https://gerrit.libreoffice.org/18669
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 54c868a..28a606c 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3255,6 +3255,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);
 }
 
@@ -3262,12 +3263,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
@@ -3322,60 +3325,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 );
 }
 
@@ -3405,12 +3418,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