tdf#131679 sw: follow-up: Unmark before SetSelection()

Backporting this to 6.4, it crashes in CppunitTest_desktop_lib because
some sidebar is loaded from SwView::AttrChangedNotify()/SelectShell()
and that ends up calling SwView::StateTabWin() about 40 stack frames
later and this calls SwFEShell::GetAnyCurRect() which gets the still
selected fly but its page frame is null.

So make sure shells don't see the deleted fly.

Change-Id: I6e994b26949d195aa9f326f4da193c69b0ee59c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104815
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
This commit is contained in:
Michael Stahl
2020-10-26 18:50:19 +01:00
committed by Michael Stahl
parent ed943c6afe
commit f63afb95b5
+5 -1
View File
@@ -412,6 +412,7 @@ void SwFlyFrame::FinitDrawObj()
if (SwFEShell *const pFEShell = dynamic_cast<SwFEShell*>(&rCurrentShell))
{ // tdf#131679 move any cursor out of fly
SwFlyFrame const*const pOldSelFly = ::GetFlyFromMarked(nullptr, pFEShell);
rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
if (pOldSelFly)
{
SwPosition const pos(ResolveFlyAnchor(*pOldSelFly->GetFormat()));
@@ -421,7 +422,10 @@ void SwFlyFrame::FinitDrawObj()
// does, but that would access layout a bit much...
}
}
rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
else
{
rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
}
}
}
}