From 539470ebd5c47a7876ccc19df6110acacd477bb8 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Sun, 26 Mar 2017 00:42:31 +0100 Subject: it makes no sense for CC to leak resources when its unaware of model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - if the UNO_QUERY_THROW cast throws, this skips all of the disposing (and thus leaks) - the whole try-catch-ignore case has been there since early c6b95527 - even in that commit message, no sane justification has been given - apparently the try-block was Java-style "catch exceptions until it runs" cargo-cult - this change is still the more conservative change: probably the whole try-catch framing should be removed Change-Id: Ie3a71e48eb056afd8a844e19898dc1555de4297e Reviewed-on: https://gerrit.libreoffice.org/35690 Tested-by: Jenkins Reviewed-by: Björn Michaelsen --- chart2/source/controller/main/ChartController.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'chart2') diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 3d163b791e1a..394a4e5b760b 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -803,8 +803,9 @@ void SAL_CALL ChartController::dispose() //--release all resources and references { - uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(getModel(), uno::UNO_QUERY_THROW); - x3DWindowProvider->setWindow(0); + uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(getModel(), uno::UNO_QUERY); + if(x3DWindowProvider.is()) + x3DWindowProvider->setWindow(0); uno::Reference< util::XModeChangeBroadcaster > xViewBroadcaster( m_xChartView, uno::UNO_QUERY ); if( xViewBroadcaster.is() ) @@ -818,7 +819,8 @@ void SAL_CALL ChartController::dispose() m_apDropTargetHelper.reset(); //the accessible view is disposed within window destructor of m_pChartWindow - m_xViewWindow->dispose(); //ChartWindow is deleted via UNO due to dispose of m_xViewWindow (triggered by Framework (Controller pretends to be XWindow also)) + if(m_xViewWindow.is()) + m_xViewWindow->dispose(); //ChartWindow is deleted via UNO due to dispose of m_xViewWindow (triggered by Framework (Controller pretends to be XWindow also)) m_xChartView.clear(); } @@ -865,6 +867,7 @@ void SAL_CALL ChartController::dispose() } catch( const uno::Exception & ex ) { + assert(!m_xChartView.is()); ASSERT_EXCEPTION( ex ); } } -- cgit