From 7542c600dc406bcd29f7a6825e4df7559676c9f7 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Wed, 11 Dec 2019 18:19:43 -0500 Subject: chart2: clear listener parents in dispose Change-Id: Icdab125589ab0f55255f683a1ea39e036de661b1 Reviewed-on: https://gerrit.libreoffice.org/84997 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian --- chart2/source/controller/main/ChartWindow.cxx | 1 + chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx | 7 ++++++- chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'chart2') diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx index 2a3bd54a85e6..0971fd079ca1 100644 --- a/chart2/source/controller/main/ChartWindow.cxx +++ b/chart2/source/controller/main/ChartWindow.cxx @@ -74,6 +74,7 @@ ChartWindow::~ChartWindow() void ChartWindow::dispose() { + m_pWindowController = nullptr; m_pViewShellWindow.clear(); vcl::Window::dispose(); } diff --git a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx index b000e55c5aa6..0fa0b793b5b6 100644 --- a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx +++ b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx @@ -27,12 +27,17 @@ ChartSidebarModifyListener::~ChartSidebarModifyListener() void ChartSidebarModifyListener::modified(const css::lang::EventObject& /*rEvent*/) { - mpParent->updateData(); + if (mpParent) + mpParent->updateData(); } void ChartSidebarModifyListener::disposing(const css::lang::EventObject& /*rEvent*/) { + if (!mpParent) + return; + mpParent->modelInvalid(); + mpParent = nullptr; } } } diff --git a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx index e037fc39aa5f..e7d74c656a55 100644 --- a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx +++ b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx @@ -41,6 +41,9 @@ ChartSidebarSelectionListener::~ChartSidebarSelectionListener() void ChartSidebarSelectionListener::selectionChanged(const css::lang::EventObject& rEvent) { + if (!mpParent) + return; + bool bCorrectObjectSelected = false; css::uno::Reference xController(rEvent.Source, css::uno::UNO_QUERY); @@ -66,6 +69,10 @@ void ChartSidebarSelectionListener::selectionChanged(const css::lang::EventObjec void ChartSidebarSelectionListener::disposing(const css::lang::EventObject& /*rEvent*/) { + if (!mpParent) + return; + + mpParent = nullptr; } void ChartSidebarSelectionListener::setAcceptedTypes(const std::vector& aTypes) -- cgit