summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2023-02-27 11:20:09 +0100
committerAndras Timar <andras.timar@collabora.com>2023-03-12 18:12:19 +0100
commit06065b600d7ff84baf83f2485455be816d0cd9b8 (patch)
treef892258d4071fe54e4cc1268d0065ee192221bb6 /chart2
parentc98535a304e51c03765fc106c9528ecfb3c13f33 (diff)
tdf#153858 sw: crash fix for chart with deleted data table
Using mouse, e.g. simply moving the mouse pointer during editing a chart with a deleted data table crashed Writer immediately. Follow-up to commit 5b9855acc7fa6d1e4a5f53ff0bc47e1dd4729827 "tdf#132714 sw: fix crash at table row deletion associated to a chart". Change-Id: I6d89eabc84565c548e2d9ded922789d623367ce4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147882 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 4f2dcc4bc70c3602e2612dab611b610410637920) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147898 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx26
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx13
2 files changed, 26 insertions, 13 deletions
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 2bf6af625555..c60ff1ca364a 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -124,13 +124,15 @@ OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries,
uno::Reference<data::XDataSequence> xDataSequence( aDataSequences[nN]->getValues());
if( !xDataSequence.is() )
continue;
- Sequence< Any > aData( xDataSequence->getData() );
- if( nPointIndex >= aData.getLength() )
- continue;
- uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY );
- if( xProp.is())
+
+ try
{
- try
+ Sequence< Any > aData( xDataSequence->getData() );
+
+ if( nPointIndex >= aData.getLength() )
+ continue;
+ uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY );
+ if( xProp.is())
{
uno::Any aARole = xProp->getPropertyValue( "Role" );
OUString aRole;
@@ -179,10 +181,14 @@ OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries,
a_Size = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
}
}
- catch( const uno::Exception& )
- {
- TOOLS_WARN_EXCEPTION("chart2", "" );
- }
+ }
+ catch (const lang::DisposedException&)
+ {
+ TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" );
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
}
}
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index e2bc3cfbe7d0..47b3ad979b05 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -208,10 +208,17 @@ uno::Reference< chart2::data::XLabeledDataSequence >
if( ! xSource.is())
return aNoResult;
const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLabeledSeq( xSource->getDataSequences());
- for (auto const & i : aLabeledSeq)
+ try
+ {
+ for (auto const & i : aLabeledSeq)
+ {
+ if (lcl_MatchesRole(aRole, bMatchPrefix)(i))
+ return i;
+ }
+ }
+ catch (const lang::DisposedException&)
{
- if (lcl_MatchesRole(aRole, bMatchPrefix)(i))
- return i;
+ TOOLS_WARN_EXCEPTION( "chart2", "unexpected exception caught" );
}
return aNoResult;