calligra/calligra-3.2.1-ChartTool-KoFormulaTool-Guard-against-crash-if-activ.patch

46 lines
1.6 KiB
Diff
Raw Permalink Normal View History

From 3bedba886436fb6cee2d92f446d4674ae431cab0 Mon Sep 17 00:00:00 2001
From: Dag Andersen <dag.andersen@kdemail.net>
Date: Tue, 30 Jun 2020 09:08:42 +0200
Subject: [PATCH 10/54] ChartTool, KoFormulaTool: Guard against crash if
activated without shape
---
plugins/chartshape/ChartTool.cpp | 5 ++++-
plugins/formulashape/KoFormulaTool.cpp | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/plugins/chartshape/ChartTool.cpp b/plugins/chartshape/ChartTool.cpp
index 33d9bb6d876..3fbf8c49f11 100644
--- a/plugins/chartshape/ChartTool.cpp
+++ b/plugins/chartshape/ChartTool.cpp
@@ -267,7 +267,10 @@ void ChartTool::activate(ToolActivation, const QSet<KoShape*> &shapes)
void ChartTool::deactivate()
{
debugChartTool<<d->shape;
-
+ if (!d->shape) {
+ // activated without shape
+ return;
+ }
foreach (QWidget *w, optionWidgets()) {
ConfigWidgetBase *configWidget = dynamic_cast<ConfigWidgetBase*>(w);
if (configWidget)
diff --git a/plugins/formulashape/KoFormulaTool.cpp b/plugins/formulashape/KoFormulaTool.cpp
index 6db24cad001..070633348ce 100644
--- a/plugins/formulashape/KoFormulaTool.cpp
+++ b/plugins/formulashape/KoFormulaTool.cpp
@@ -128,6 +128,10 @@ void KoFormulaTool::deactivate()
for (const TemplateAction &templateAction : koAsConst(m_templateActions)) {
disconnect(templateAction.action, &QAction::triggered, this, nullptr);
}
+ if (!m_formulaShape) {
+ // activated without shape
+ return;
+ }
disconnect(m_formulaShape->formulaData(),0,this,0);
if (canvas()) {
m_cursorList.append(m_formulaEditor);
--
2.31.1