summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-21 18:00:03 +0200
committerAndras Timar <andras.timar@collabora.com>2016-10-26 14:18:18 +0200
commit8b8567c527fab51f70346910a9c94a82d0e03ebf (patch)
tree79efd1eae5deba5da7766bbf116cf3049ef1c1df
parent3a63fc0b3ab9dc87b51fead71ac22f8b15ca16cd (diff)
Avoid further crash with empty Chart document
following up on 8b5f8c26f007c8e67bc46b1b09340cae660d0b8b "Avoid crash with empty Chart document", when you then close the Writer doc (discarding the changes), it crashes in a chart::sidebar::ChartSidebarModifyListener::disposing call whose mpParent (that was a ChartElementsPanel) is already destroyed. The problem is that the ChartElementsPanel ctor creates an mxListener pointing to this, then calls Initialize, which calls xBroadcaster->addModifyListener(mxListener) and then, during updateData, throws a RuntimeException when xDiagram is null in getChartType, causing the ChartElementsPanel object to immediately be destroyed, but the listener still registered. This apparently needs fixing independently of the immediate problem. (The immediate problem is a regression introduced with d7748842e96536daeb0c638c6f8d01d99b9a3e08 "hide grid and axes options in chart elements if not supported, tdf#94297".) Change-Id: I2fe4f2a59600664f6210456c65e033f9453f4cc9 (cherry picked from commit 429e4dc671f03e0c4d50e8f8aa055f4aaca761da) Reviewed-on: https://gerrit.libreoffice.org/30146 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 4bbd59e113749bf8e9eda7c25683b99f34d6866e)
-rw-r--r--chart2/source/controller/sidebar/ChartElementsPanel.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 223f5eb97795..1f8b7748b7d8 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -388,6 +388,9 @@ css::uno::Reference<css::chart2::XChartType> getChartType(css::uno::Reference<cs
{
css::uno::Reference<css::chart2::XChartDocument> xChartDoc(xModel, css::uno::UNO_QUERY_THROW);
css::uno::Reference<chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();
+ if (!xDiagram.is()) {
+ return css::uno::Reference<css::chart2::XChartType>();
+ }
css::uno::Reference<css::chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, css::uno::UNO_QUERY_THROW );