diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-09-19 17:21:39 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2016-10-03 12:07:42 +0000 |
commit | 3fcd1f80afcf789fbafae2a4360b62111089a5cd (patch) | |
tree | 74cc83ac8c98f74483dd467fa8c3cf85417381a6 /sc | |
parent | f5ed92549b9f113cbe252820a01a098b2b9d65ab (diff) |
Calc: edit engine could be accessed after being destroyed
ScTabView <---------------- ScTabViewShell
+ScViewData +ScInputHandler
+EditView[4] +EditEngine
+ImpEditEngine
+vector<pointer<EditView>>
On tab view shell destruction:
~ScTabViewShell -> ~ScTabView -> ScViewData::KillEditView ->
EditEngine::RemoveView
but it occurs after the following:
~ScTabViewShell -> ~ScInputHandler -> ~EditEngine
since data members are destroyed before ancestor classes.
Change-Id: Ida56b8009c0d8a3cd23952259d78318e96ae5124
Reviewed-on: https://gerrit.libreoffice.org/29409
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 7 |
2 files changed, 14 insertions, 9 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 964896d714a5..d440c691e175 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -661,14 +661,14 @@ ScInputHandler::~ScInputHandler() if ( pInputWin && pInputWin->GetInputHandler() == this ) pInputWin->SetInputHandler( nullptr ); - delete pRangeFindList; - delete pEditDefaults; - delete pEngine; - delete pLastState; - delete pDelayTimer; - delete pColumnData; - delete pFormulaData; - delete pFormulaDataPara; + delete pRangeFindList; pRangeFindList = nullptr; + delete pEditDefaults; pEditDefaults = nullptr; + delete pEngine; pEngine = nullptr; + delete pLastState; pLastState = nullptr; + delete pDelayTimer; pDelayTimer = nullptr; + delete pColumnData; pColumnData = nullptr; + delete pFormulaData; pFormulaData = nullptr; + delete pFormulaDataPara; pFormulaDataPara = nullptr; } void ScInputHandler::SetRefScale( const Fraction& rX, const Fraction& rY ) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index c79f53ccac60..240661d11c18 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1435,11 +1435,16 @@ void ScViewData::ResetEditView() void ScViewData::KillEditView() { + EditEngine* pEngine = nullptr; for (sal_uInt16 i=0; i<4; i++) if (pEditView[i]) { if (bEditActive[i]) - pEditView[i]->GetEditEngine()->RemoveView(pEditView[i]); + { + pEngine = pEditView[i]->GetEditEngine(); + if (pEngine) + pEngine->RemoveView(pEditView[i]); + } delete pEditView[i]; pEditView[i] = nullptr; } |