diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-09-09 10:15:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-09-09 12:41:59 +0200 |
commit | c36fff84afb7eaa05fa065e15009c9426a5af44e (patch) | |
tree | c6e65c13fe1917a4bfa9652a17fe173f18e5f699 /sc | |
parent | 89b8e97bf325a92f49756fe903b322653cd88266 (diff) |
Resolves: tdf#144376 focus into protected ScTextWnd shouldn't be possible
the expectations are that this isn't possible and if it happens then
under windows there is a QueryCharPosition which will trigger the
deletion of the ScTextWnd EditView due to that expectation before it is
then unconditionally dereferenced
Change-Id: Ied5d8031ae7d74669a2958dbcdec87843a26d384
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121839
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/inc/inputwin.hxx | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 76e57e1833ca..1a0bcc828767 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1639,12 +1639,17 @@ bool ScTextWnd::MouseMove( const MouseEvent& rMEvt ) return m_xEditView && m_xEditView->MouseMove(rMEvt); } +bool ScTextWnd::CanFocus() const +{ + return SC_MOD()->IsEditMode(); +} + bool ScTextWnd::MouseButtonDown( const MouseEvent& rMEvt ) { if (!HasFocus()) { StartEditEngine(); - if ( SC_MOD()->IsEditMode() ) + if (CanFocus()) TextGrabFocus(); } diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index 20991ac85908..86cc6594910c 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -120,6 +120,7 @@ protected: virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override; virtual bool Command( const CommandEvent& rCEvt ) override; virtual bool KeyInput(const KeyEvent& rKEvt) override; + virtual bool CanFocus() const override; virtual void GetFocus() override; virtual bool StartDrag() override; |