[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 28 14:42:55 UTC 2021


 vcl/unx/gtk3/gtkinst.cxx |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

New commits:
commit a0f6d3865dd113f38fd3aa673075e9fecd06f3cd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 28 12:10:33 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 28 16:42:18 2021 +0200

    tdf#144139 don't crash when OutputDevice is a printer
    
    Change-Id: Ia3843966949b8164b01cecd762ea2b5c5bf0339b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122777
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 36ea3f96fa27..7782205fde56 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -4358,7 +4358,19 @@ public:
 
         VclPtr<VirtualDevice> xOutput(VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT));
         xOutput->SetOutputSizePixel(aSize);
-        xOutput->DrawOutDev(Point(), aSize, rPos, aSize, rOutput);
+
+        switch (rOutput.GetOutDevType())
+        {
+            case OUTDEV_WINDOW:
+            case OUTDEV_VIRDEV:
+                xOutput->DrawOutDev(Point(), aSize, rPos, aSize, rOutput);
+                break;
+            case OUTDEV_PRINTER:
+            case OUTDEV_PDF:
+                xOutput->SetBackground(rOutput.GetBackground());
+                xOutput->Erase();
+                break;
+        }
 
         cairo_surface_t* pSurface = get_underlying_cairo_surface(*xOutput);
         cairo_t* cr = cairo_create(pSurface);
@@ -4376,7 +4388,17 @@ public:
         gtk_widget_size_allocate(m_pWidget, &aOrigAllocation, 0);
 #endif
 
-        rOutput.DrawOutDev(rPos, aSize, Point(), aSize, *xOutput);
+        switch (rOutput.GetOutDevType())
+        {
+            case OUTDEV_WINDOW:
+            case OUTDEV_VIRDEV:
+                rOutput.DrawOutDev(rPos, aSize, Point(), aSize, *xOutput);
+                break;
+            case OUTDEV_PRINTER:
+            case OUTDEV_PDF:
+                rOutput.DrawBitmapEx(rPos, xOutput->GetBitmapEx(Point(), aSize));
+                break;
+        }
 
         if (bAnimations)
             g_object_set(pSettings, "gtk-enable-animations", true, nullptr);


More information about the Libreoffice-commits mailing list