diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2015-09-17 19:24:04 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2015-09-17 19:35:55 +0200 |
commit | a4677e8d868840ade21d74938c29ccdf75e9c666 (patch) | |
tree | 6633144cd436fc2897609a9518cac03aacb26cbe /svx/source/fmcomp | |
parent | ca7b7e96d00a52187b617193704430d59e907c79 (diff) |
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
Diffstat (limited to 'svx/source/fmcomp')
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 934be2eca6c7..04b8c2b93ea4 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 ); } |