summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2015-09-17 19:24:04 +0200
committerAndras Timar <andras.timar@collabora.com>2015-10-17 23:22:24 +0200
commit1eecb037d7f905edf594b74e99c41436d885d2bf (patch)
treedc91b4ad9459de227eae262fddb5b5554bc41275 /svx
parentd2fa9168bd7ca128e339d9d74cc544d8edbfc4b1 (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 Reviewed-on: https://gerrit.libreoffice.org/18669 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 6f3824673c6b0d360dd3bbeed7aa3b6c33135aea)
Diffstat (limited to 'svx')
-rw-r--r--svx/source/fmcomp/gridcell.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 54c868a98505..28a606c1be5e 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 );
}