[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-7-0+backports' - include/svx svx/source sw/source

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 26 09:38:34 UTC 2020


 include/svx/sdrpagewindow.hxx       |    4 ++--
 svx/source/svdraw/sdrpagewindow.cxx |   33 +++++++--------------------------
 svx/source/svdraw/svdpagv.cxx       |   11 +++++------
 sw/source/core/view/viewsh.cxx      |    5 ++---
 4 files changed, 16 insertions(+), 37 deletions(-)

New commits:
commit 1297eab938570ef6ffd7526fb59e1b97fdb22de8
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Wed Nov 25 16:40:20 2020 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Nov 26 10:37:53 2020 +0100

    HACK: Revert "tdf#132940 Crash in mergedlo!vcl::Region::operator="
    
    This commit causes merge conflicts with the
    'distro/lhm/libreoffice-7-0+all' branch, due to the revert of
    commit 424312aa99307da9f0ee60ea6e3213b2b3dc26b4:
    
        commit 3bf97ca63dafa13cbfccd6a1e76e9c1cb1faf0a0
        Author: Michael Weghorn <m.weghorn at posteo.de>
        Date:   Fri Mar 13 08:02:39 2020 +0100
    
            DEMO: tdf#131281 Revert "tdf#130768 Make tiled writer paint reuse decomposes"
    
            Revert the commit that introduced the regression for now,
            to make form controls like radio buttons and checkboxes
            shown in Android Viewer again, s. tdf#131281 for more details.
    
            This reverts commit 424312aa99307da9f0ee60ea6e3213b2b3dc26b4.
    
            TODO: replace with a proper fix once one is there
            Change-Id: Ibf5fbbf76688c94a5b557856c2ad2ce7e9aa7b1e
            (cherry picked from commit 4d2fcf627dde353ef875bdd7c7708c290ab788a0)
    
    While this conflict can be resolved rather easily in a formal way by
    just removing the parts that 424312aa99307da9f0ee60ea6e3213b2b3dc26b4
    had introduced, this would need further digging into the code whether
    it's actually a valid approach or rather makes things worse.
    
    Since a proper solution for tdf#131281 is being worked on, just
    revert this commit here as well for this branch for now to resolve the
    merge conflict easily; at a quick glance, tdf#132940 does not sound like
    it should be problematic for our Android Viewer use cases anyway.
    
    This reverts commit 39f42fbd3f91afad60dad2937d2dfed79b956485.
    
    Change-Id: I48c04f5bc8161e6d8b95499c7217120607cb2f24
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106595
    Tested-by: Michael Weghorn <m.weghorn at posteo.de>
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/include/svx/sdrpagewindow.hxx b/include/svx/sdrpagewindow.hxx
index f5cb98c297da..80417a6729a0 100644
--- a/include/svx/sdrpagewindow.hxx
+++ b/include/svx/sdrpagewindow.hxx
@@ -68,8 +68,8 @@ public:
     rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const;
 
     // #i72752# allow patcing SdrPaintWindow from SdrPageView::DrawLayer if needed
-    [[nodiscard]] SdrPaintWindow* patchPaintWindow(SdrPaintWindow& rPaintWindow);
-    void unpatchPaintWindow(SdrPaintWindow* pPreviousPaintWindow);
+    void patchPaintWindow(SdrPaintWindow& rPaintWindow);
+    void unpatchPaintWindow();
 
     // the repaint method. For migration from pPaintProc, use one more parameter
     void PrePaint();
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index 6d197dab5282..fb3155c0eb14 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -163,41 +163,22 @@ rtl::Reference< sdr::overlay::OverlayManager > const & SdrPageWindow::GetOverlay
     return GetPaintWindow().GetOverlayManager();
 }
 
-SdrPaintWindow* SdrPageWindow::patchPaintWindow(SdrPaintWindow& rPaintWindow)
+void SdrPageWindow::patchPaintWindow(SdrPaintWindow& rPaintWindow)
 {
-    if (!mpImpl->mpOriginalPaintWindow)
-    {
-        // first patch
-        mpImpl->mpOriginalPaintWindow = mpImpl->mpPaintWindow;
-        mpImpl->mpPaintWindow = &rPaintWindow;
-        mpImpl->mpOriginalPaintWindow->setPatched(&rPaintWindow);
-        return mpImpl->mpOriginalPaintWindow;
-    }
-    else
-    {
-        // second or more patch
-        auto pPreviousPaintWindow = mpImpl->mpPaintWindow;
-        mpImpl->mpPaintWindow = &rPaintWindow;
-        mpImpl->mpOriginalPaintWindow->setPatched(&rPaintWindow);
-        return pPreviousPaintWindow;
-    }
+    mpImpl->mpOriginalPaintWindow = mpImpl->mpPaintWindow;
+    mpImpl->mpPaintWindow = &rPaintWindow;
+    mpImpl->mpOriginalPaintWindow->setPatched(&rPaintWindow);
 }
 
-void SdrPageWindow::unpatchPaintWindow(SdrPaintWindow* pPreviousPaintWindow)
+void SdrPageWindow::unpatchPaintWindow()
 {
-    if (pPreviousPaintWindow == mpImpl->mpOriginalPaintWindow)
+    DBG_ASSERT(mpImpl->mpOriginalPaintWindow, "SdrPageWindow::unpatchPaintWindow: paint window not patched!" );
+    if (mpImpl->mpOriginalPaintWindow)
     {
-        // first patch
         mpImpl->mpPaintWindow = mpImpl->mpOriginalPaintWindow;
         mpImpl->mpOriginalPaintWindow->setPatched(nullptr);
         mpImpl->mpOriginalPaintWindow = nullptr;
     }
-    else
-    {
-        // second or more patch
-        mpImpl->mpPaintWindow = pPreviousPaintWindow;
-        mpImpl->mpOriginalPaintWindow->setPatched(pPreviousPaintWindow);
-    }
 }
 
 void SdrPageWindow::PrePaint()
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 480182782984..215e37bc7c94 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -32,7 +32,6 @@
 #include <svx/sdrpagewindow.hxx>
 #include <svx/sdrpaintwindow.hxx>
 #include <comphelper/lok.hxx>
-#include <comphelper/scopeguard.hxx>
 #include <basegfx/range/b2irectangle.hxx>
 
 using namespace ::com::sun::star;
@@ -291,13 +290,13 @@ void SdrPageView::DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget,
                     else
                         aTemporaryPaintWindow.SetRedrawRegion(vcl::Region(rRect));
                     // patch the ExistingPageWindow
-                    auto pPreviousWindow = pPreparedTarget->patchPaintWindow(aTemporaryPaintWindow);
-                    // unpatch window when leaving the scope
-                    const ::comphelper::ScopeGuard aGuard(
-                        [&pPreviousWindow, &pPreparedTarget]() { pPreparedTarget->unpatchPaintWindow(pPreviousWindow); } );
-                    
+                    pPreparedTarget->patchPaintWindow(aTemporaryPaintWindow);
+
                     // redraw the layer
                     pPreparedTarget->RedrawLayer(&nID, pRedirector, pPageFrame);
+
+                    // restore the ExistingPageWindow
+                    pPreparedTarget->unpatchPaintWindow();
                 }
                 else
                 {
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index ef26275ab9fd..b711cf472bad 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1719,7 +1719,6 @@ class RenderContextGuard
 {
     std::unique_ptr<SdrPaintWindow> m_TemporaryPaintWindow;
     SdrPageWindow* m_pPatchedPageWindow;
-    SdrPaintWindow* m_pPreviousPaintWindow = nullptr;
 
 public:
     RenderContextGuard(VclPtr<vcl::RenderContext>& pRef, vcl::RenderContext* pValue, SwViewShell* pShell)
@@ -1742,7 +1741,7 @@ public:
                     if (nullptr != m_pPatchedPageWindow)
                     {
                         m_TemporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, *pValue));
-                        m_pPreviousPaintWindow = m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow);
+                        m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow);
                     }
                 }
             }
@@ -1753,7 +1752,7 @@ public:
     {
         if(nullptr != m_pPatchedPageWindow)
         {
-            m_pPatchedPageWindow->unpatchPaintWindow(m_pPreviousPaintWindow);
+            m_pPatchedPageWindow->unpatchPaintWindow();
         }
     }
 };


More information about the Libreoffice-commits mailing list