[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra] plugins/chartshape: ChartShape: Fix crash due to accessing stale pointers
From:       Dag Andersen <danders () get2net ! dk>
Date:       2016-11-23 8:14:40
Message-ID: E1c9ShU-0001LE-C7 () code ! kde ! org
[Download RAW message or body]

Git commit a43eeed42b629cb84ce2167c5e70ae1ee580ce68 by Dag Andersen.
Committed on 23/11/2016 at 08:14.
Pushed by danders into branch 'master'.

ChartShape: Fix crash due to accessing stale pointers

Summary:
Some data pointers where not reset when shape selection changed,
thus accessing data from privously selected shape.

Test:
Add a chart to eg sheets
Undo
Add another shape to chart

Result before: crash
After: No crash

This may have bearing on:
CCBUG: 365238
but needs more testing.

Reviewers: mecir, boemann

Reviewed By: boemann

Tags: #kexi, #calligra:_3.0

Differential Revision: https://phabricator.kde.org/D3455

M  +9    -0    plugins/chartshape/ChartConfigWidget.cpp

https://commits.kde.org/calligra/a43eeed42b629cb84ce2167c5e70ae1ee580ce68

diff --git a/plugins/chartshape/ChartConfigWidget.cpp b/plugins/chartshape/ChartConfigWidget.cpp
index 375177b..8c22040 100644
--- a/plugins/chartshape/ChartConfigWidget.cpp
+++ b/plugins/chartshape/ChartConfigWidget.cpp
@@ -566,6 +566,15 @@ void ChartConfigWidget::deleteSubDialogs()
 
 void ChartConfigWidget::open(KoShape* shape)
 {
+    // reset these so we do not risc using old, deleted data
+    d->selectedDataSet = 0;
+    d->shape = 0;
+    d->tableSource = 0;
+    // these are recalculated in update() anyway
+    d->dataSetAxes.clear();
+    d->axes.clear();
+    d->dataSets.clear();
+
     if (! shape) {
         return;
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic