Kaydet (Commit) a92e3539 authored tarafından Jürgen Schmidt's avatar Jürgen Schmidt

119912: Crash when redo split the pasted table

fix: While deleting any box from chart data provider, verify whether there are any invalidate chart data sequence inside, if so, catch the exception and remove it.

Patch By: Peng Chen
Found By: yanji
Review By: jsc
üst 3977937c
...@@ -1655,6 +1655,7 @@ sal_Bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox ...@@ -1655,6 +1655,7 @@ sal_Bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox
{ {
SwChartDataSequence *pDataSeq = 0; SwChartDataSequence *pDataSeq = 0;
sal_Bool bNowEmpty = sal_False; sal_Bool bNowEmpty = sal_False;
sal_Bool bSeqDisposed = sal_False;
// check if weak reference is still valid... // check if weak reference is still valid...
// uno::Reference< chart2::data::XDataSequence > xRef( uno::Reference< chart2::data::XDataSequence>(*aIt), uno::UNO_QUERY ); // uno::Reference< chart2::data::XDataSequence > xRef( uno::Reference< chart2::data::XDataSequence>(*aIt), uno::UNO_QUERY );
...@@ -1666,10 +1667,19 @@ sal_Bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox ...@@ -1666,10 +1667,19 @@ sal_Bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox
pDataSeq = static_cast< SwChartDataSequence * >( xRef.get() ); pDataSeq = static_cast< SwChartDataSequence * >( xRef.get() );
if (pDataSeq) if (pDataSeq)
{ {
try
{
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
OUString aRangeStr( pDataSeq->getSourceRangeRepresentation() ); OUString aRangeStr( pDataSeq->getSourceRangeRepresentation() );
#endif #endif
bNowEmpty = pDataSeq->DeleteBox( rBox ); bNowEmpty = pDataSeq->DeleteBox( rBox );
}
catch (lang::DisposedException&)
{
bNowEmpty = sal_True;
bSeqDisposed = sal_True;
}
if (bNowEmpty) if (bNowEmpty)
aDelIt = aIt; aDelIt = aIt;
} }
...@@ -1679,7 +1689,7 @@ sal_Bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox ...@@ -1679,7 +1689,7 @@ sal_Bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox
if (bNowEmpty) if (bNowEmpty)
{ {
rSet.erase( aDelIt ); rSet.erase( aDelIt );
if (pDataSeq) if (pDataSeq && !bSeqDisposed)
pDataSeq->dispose(); // the current way to tell chart that sth. got removed pDataSeq->dispose(); // the current way to tell chart that sth. got removed
} }
} }
...@@ -2636,6 +2646,9 @@ void SAL_CALL SwChartDataSequence::removeEventListener( ...@@ -2636,6 +2646,9 @@ void SAL_CALL SwChartDataSequence::removeEventListener(
sal_Bool SwChartDataSequence::DeleteBox( const SwTableBox &rBox ) sal_Bool SwChartDataSequence::DeleteBox( const SwTableBox &rBox )
{ {
if (bDisposed)
throw lang::DisposedException();
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
String aBoxName( rBox.GetName() ); String aBoxName( rBox.GetName() );
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment