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

Armin Le Grand (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 27 18:25:18 UTC 2020


 sw/source/core/doc/notxtfrm.cxx |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 5f58ffce789c15e3849bceb9fe4844d838e9c40e
Author:     Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Thu Feb 27 17:21:16 2020 +0100
Commit:     Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Thu Feb 27 19:24:46 2020 +0100

    tdf#130951 Use the correct OutputDevice
    
    In SwViewShell mode maybe isOutputToWindow,
    in that cases use GetWin() instead of GetOut()
    
    Change-Id: I181ac436000325f3aa93cd508e468d500a682131
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89644
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 12f6e6045b3d..53d878c684ec 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1309,13 +1309,25 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
                     // repaint to VOC and Primitives, too.
                     static const char* pDisableMM02Goodies(getenv("SAL_DISABLE_MM02_GOODIES"));
                     static bool bUseViewObjectContactMechanism(nullptr == pDisableMM02Goodies);
+                    // tdf#130951 for safety reasons use fallback if ViewObjectContactMechanism
+                    // fails for some reason - usually could only be not to find the correct
+                    // SdrPageWindow
+                    bool bSucceeded(false);
 
                     if(bUseViewObjectContactMechanism)
                     {
                         // MM02 use VOC-mechanism and buffer primitives
                         SwViewShellImp* pImp(pShell->Imp());
-                        SdrPageView* pPageView(nullptr != pImp ? pImp->GetPageView() : nullptr);
-                        SdrPageWindow* pPageWindow(nullptr != pPageView ? pPageView->FindPageWindow(*pShell->GetOut()) : nullptr);
+                        SdrPageView* pPageView(nullptr != pImp
+                            ? pImp->GetPageView()
+                            : nullptr);
+                        // tdf#130951 caution - target may be Window, use the correct OutputDevice
+                        OutputDevice* pTarget(pShell->isOutputToWindow()
+                            ? pShell->GetWin()
+                            : pShell->GetOut());
+                        SdrPageWindow* pPageWindow(nullptr != pPageView && nullptr != pTarget
+                            ? pPageView->FindPageWindow(*pTarget)
+                            : nullptr);
 
                         if(nullptr != pPageWindow)
                         {
@@ -1334,9 +1346,11 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
                                 nullptr == pGrfNd->GetFlyFormat() ? OUString() : pGrfNd->GetFlyFormat()->GetName(),
                                 rNoTNd.GetTitle(),
                                 rNoTNd.GetDescription());
+                            bSucceeded = true;
                         }
                     }
-                    else
+
+                    if(!bSucceeded)
                     {
                         // MM02 fallback to direct paint with primitive-recreation
                         // which will block reusage of system-dependent bitmap data


More information about the Libreoffice-commits mailing list