[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sd/source

Jan Holesovsky kendy at collabora.com
Thu Mar 23 07:13:01 UTC 2017


 sd/source/ui/view/Outliner.cxx |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 8517c54621c94f7329be41b38fa8da54eb47a960
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Mar 22 12:38:40 2017 +0100

    lok sd: Fix crash when searching.
    
    This is a follow-up of ed5450f2a5ed8e72b48b4d976217746cea04a5c9 where the
    check for the HasView has been removed.  Turns out that there are conditions
    when this really can happen, leading to crashes in the LOK searching.
    
    Unfortunately I did not manage to find a reliable reproducer to create a
    unit test :-( - so I suspect this commit might be more a workaround than a
    root cause fix.  Would be great to find out the exact conditions leading to
    the situation when the EditEngine does not contain the EditView, and evaluate
    this fix against that - but that's hard without a reliable reproducer.
    
    A unit test for this fix is missing from the same reason.  The unit test from
    ed5450f2a5ed8e72b48b4d976217746cea04a5c9 still passes.
    
    (cherry picked from commit 9fc3d9b445d8c2bb8e259b42430cfe089642ab03)
    
    Change-Id: I1cca7219817119d27a224b35efb660a84d35b8fa

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 1db238667469..1fabed090f94 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -714,10 +714,14 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections)
     DetectChange ();
 
     OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
-    if (!pOutlinerView)
-        return true; // end of search
-
     std::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock());
+
+    if (!pOutlinerView || !GetEditEngine().HasView(&pOutlinerView->GetEditView()))
+    {
+        mpImpl->ProvideOutlinerView(*this, pViewShell, mpWindow);
+        pOutlinerView = mpImpl->GetOutlinerView();
+    }
+
     if (pViewShell != nullptr)
     {
         mpView = pViewShell->GetView();
@@ -1771,21 +1775,26 @@ void Outliner::Implementation::ProvideOutlinerView (
             {
                 // Create a new outline view to do the search on.
                 bool bInsert = false;
-                if (mpOutlineView!=nullptr && !mbOwnOutlineView)
+                if (mpOutlineView != nullptr && !mbOwnOutlineView)
                     mpOutlineView = nullptr;
-                if (mpOutlineView == nullptr)
+
+                if (mpOutlineView == nullptr || !rOutliner.GetEditEngine().HasView(&mpOutlineView->GetEditView()))
                 {
+                    delete mpOutlineView;
                     mpOutlineView = new OutlinerView(&rOutliner, pWindow);
                     mbOwnOutlineView = true;
                     bInsert = true;
                 }
                 else
                     mpOutlineView->SetWindow(pWindow);
+
                 EVControlBits nStat = mpOutlineView->GetControlWord();
                 nStat &= ~EVControlBits::AUTOSCROLL;
                 mpOutlineView->SetControlWord(nStat);
+
                 if (bInsert)
                     rOutliner.InsertView( mpOutlineView );
+
                 rOutliner.SetUpdateMode(false);
                 mpOutlineView->SetOutputArea (Rectangle (Point(), Size(1, 1)));
                 rOutliner.SetPaperSize( Size(1, 1) );


More information about the Libreoffice-commits mailing list