[Libreoffice-commits] core.git: sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 26 17:51:02 UTC 2020


 sw/source/core/layout/fly.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit f63afb95b5c2d80d33a35820ef1d9abd9e70d3ca
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 26 16:17:04 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Oct 26 18:50:19 2020 +0100

    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 at cib.de>

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 1122809daa05..d44af82f1eac 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -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();
+                    }
                 }
             }
         }


More information about the Libreoffice-commits mailing list