From ac6568e412821b4fc9c347cc1bb56ccd65311c27 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 14 Feb 2014 12:28:03 -0500 Subject: fdo#73773: Check if the *document* is closing, not the *app*. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise it would crash if the app has multiple document instances open and only one of them is being closed. (cherry picked from commit 76bdf523981d2bd983dac4e01bc5cc934118a73f) Conflicts: sc/source/ui/app/inputhdl.cxx Change-Id: Ib6e370037ab6097c9c6eff8035249663944b3a6c Reviewed-on: https://gerrit.libreoffice.org/8055 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sc/source/ui/app/inputhdl.cxx | 8 +++++++- sc/source/ui/inc/inputhdl.hxx | 3 +++ sc/source/ui/view/tabvwsh4.cxx | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index b31489c4db00..a45ac8f741c8 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -298,6 +298,11 @@ handle_r1c1: } } +void ScInputHandler::SetDocumentDisposing( bool b ) +{ + mbDocumentDisposing = b; +} + static void lcl_Replace( EditView* pView, const String& rNewStr, const ESelection& rOldSel ) { if ( pView ) @@ -519,6 +524,7 @@ ScInputHandler::ScInputHandler() bProtected( false ), bCellHasPercentFormat( false ), bLastIsSymbol( false ), + mbDocumentDisposing(false), nValidation( 0 ), eAttrAdjust( SVX_HOR_JUSTIFY_STANDARD ), aScaleX( 1,1 ), @@ -542,7 +548,7 @@ ScInputHandler::~ScInputHandler() // Wenn dies der Applikations-InputHandler ist, wird der dtor erst nach SfxApplication::Main // gerufen, darf sich also auf keine Sfx-Funktionen mehr verlassen - if ( !SFX_APP()->IsDowning() ) // inplace + if (!mbDocumentDisposing) // inplace EnterHandler(); // Eingabe noch abschliessen if (SC_MOD()->GetRefInputHdl()==this) diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index 8d0d44f9d8cd..0bb4fda5c576 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -100,6 +100,7 @@ private: bool bProtected:1; bool bCellHasPercentFormat:1; bool bLastIsSymbol:1; + bool mbDocumentDisposing:1; sal_uLong nValidation; SvxCellHorJustify eAttrAdjust; @@ -256,6 +257,8 @@ public: // actually private, public for SID_INPUT_SUM void InitRangeFinder( const String& rFormula ); + void SetDocumentDisposing( bool b ); + static void SetAutoComplete(bool bSet) { bAutoComplete = bSet; } }; diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 377546fb9120..cb920d47fd36 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1740,6 +1740,9 @@ ScTabViewShell::~ScTabViewShell() // alles auf NULL, falls aus dem TabView-dtor noch darauf zugegriffen wird //! (soll eigentlich nicht !??!?!) + if (pInputHandler) + pInputHandler->SetDocumentDisposing(true); + DELETEZ(pFontworkBarShell); DELETEZ(pExtrusionBarShell); DELETEZ(pCellShell); -- cgit v1.2.3