diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-12-08 12:58:22 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-05-23 10:45:06 +0200 |
commit | b3ac549ba096dd7bfc6842a3d8e68a3cc4ad4054 (patch) | |
tree | e27354dc0583e5065488c6bf16008a431ed233d1 | |
parent | tdf#138762: crash when trying to open sidebar w chart in Writer (diff) | |
download | core-b3ac549ba096dd7bfc6842a3d8e68a3cc4ad4054.tar.gz core-b3ac549ba096dd7bfc6842a3d8e68a3cc4ad4054.zip |
sw: fix crash in SwFEShell::SelectObj()
Crashreport signature:
SwContact::GetFormat()
sw/inc/dcontact.hxx:112
SwFEShell::SelectObj(Point const&, unsigned char, SdrObject*)
sw/source/core/frmedt/feshview.cxx:292
SwWrtShell::UnSelectFrame()
sw/source/uibase/wrtsh/select.cxx:326
SwWrtShell::DelRight()
sw/source/uibase/wrtsh/delete.cxx:467
SwBaseShell::ExecDelete(SfxRequest&)
sw/source/uibase/shells/basesh.cxx:198
I.e. it seems that in case we're in the middle of a delete, then it's
possible that the mark list contains an SdrObject that doesn't have a
matching SwClient anymore. Ignore such SdrObjects when looking for the
textbox of a draw shape.
Change-Id: I065b2ea44d39220184a5f604c3ea13f6a106ddb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126537
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 2a6fde04a7ad716117118e5dada895ec87e24de3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126564
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 2c6666b024f5..fd0a930a95a0 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -298,7 +298,13 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj ) for (size_t i = 0; i < rMrkList.GetMarkCount(); ++i) { SdrObject* pObject = rMrkList.GetMark(i)->GetMarkedSdrObj(); - SwFrameFormat* pFormat = GetUserCall(pObject)->GetFormat(); + SwContact* pContact = GetUserCall(pObject); + if (!pContact) + { + continue; + } + + SwFrameFormat* pFormat = pContact->GetFormat(); if (SwFrameFormat* pShapeFormat = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_FLYFRMFMT)) { SdrObject* pShape = pShapeFormat->FindSdrObject(); |