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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 22 09:13:56 UTC 2018


 vcl/inc/opengl/x11/salvd.hxx  |    2 +-
 vcl/inc/unx/salinst.h         |    2 +-
 vcl/inc/unx/salvd.h           |    2 +-
 vcl/opengl/x11/salvd.cxx      |    4 ++--
 vcl/unx/generic/gdi/salvd.cxx |   13 +++++++------
 vcl/unx/gtk/gtkinst.cxx       |    2 +-
 6 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit ab0f8e61f663acd0bf30469b6abadca078906b64
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Aug 22 10:01:30 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 22 11:13:34 2018 +0200

    pass X11SalGraphics around by std::unique_ptr
    
    Change-Id: Id2fcf829e3ca0edcfcdd3d4daf31188ae5317b27
    Reviewed-on: https://gerrit.libreoffice.org/59427
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/inc/opengl/x11/salvd.hxx b/vcl/inc/opengl/x11/salvd.hxx
index 94aa6b2b9124..a77b9874e48b 100644
--- a/vcl/inc/opengl/x11/salvd.hxx
+++ b/vcl/inc/opengl/x11/salvd.hxx
@@ -35,7 +35,7 @@ public:
     X11OpenGLSalVirtualDevice( SalGraphics const *pGraphics,
                                long nDX, long nDY,
                                const SystemGraphicsData *pData,
-                               X11SalGraphics* pNewGraphics);
+                               std::unique_ptr<X11SalGraphics> pNewGraphics);
     virtual ~X11OpenGLSalVirtualDevice() override;
 
     // SalGeometryProvider
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index 627754470447..697a76eb2fd0 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -59,7 +59,7 @@ public:
 
     /// Gtk vclplug needs to pass GtkSalGraphics to X11SalVirtualDevice, so create it, and pass as pNewGraphics.
     static std::unique_ptr<SalVirtualDevice> CreateX11VirtualDevice(SalGraphics const * pGraphics, long &nDX, long &nDY,
-            DeviceFormat eFormat, const SystemGraphicsData* pData, X11SalGraphics* pNewGraphics);
+            DeviceFormat eFormat, const SystemGraphicsData* pData, std::unique_ptr<X11SalGraphics> pNewGraphics);
 
     virtual std::unique_ptr<SalVirtualDevice>
                                 CreateVirtualDevice( SalGraphics* pGraphics,
diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h
index dbc489f63aab..8ad94eb6ee7d 100644
--- a/vcl/inc/unx/salvd.h
+++ b/vcl/inc/unx/salvd.h
@@ -45,7 +45,7 @@ class X11SalVirtualDevice : public SalVirtualDevice
 
 public:
     X11SalVirtualDevice(SalGraphics const *pGraphics, long &nDX, long &nDY,
-            DeviceFormat eFormat, const SystemGraphicsData *pData, X11SalGraphics* pNewGraphics);
+            DeviceFormat eFormat, const SystemGraphicsData *pData, std::unique_ptr<X11SalGraphics> pNewGraphics);
 
     virtual ~X11SalVirtualDevice() override;
 
diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx
index 9af9f02b5db4..a6ed5602fc3f 100644
--- a/vcl/opengl/x11/salvd.cxx
+++ b/vcl/opengl/x11/salvd.cxx
@@ -35,8 +35,8 @@ void X11SalGraphics::Init( X11OpenGLSalVirtualDevice *pDevice )
 X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( SalGraphics const * pGraphics,
                                                       long nDX, long nDY,
                                                       const SystemGraphicsData *pData,
-                                                      X11SalGraphics* pNewGraphics) :
-    mpGraphics(pNewGraphics),
+                                                      std::unique_ptr<X11SalGraphics> pNewGraphics) :
+    mpGraphics(std::move(pNewGraphics)),
     mbGraphics( false ),
     mnXScreen( 0 )
 {
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index d7223df9de8b..46e0fcbdf7f0 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -32,24 +32,25 @@
 
 #include <salinst.hxx>
 
+#include <o3tl/make_unique.hxx>
 #include <vcl/opengl/OpenGLHelper.hxx>
 #include <opengl/x11/salvd.hxx>
 
 std::unique_ptr<SalVirtualDevice> X11SalInstance::CreateX11VirtualDevice(SalGraphics const * pGraphics,
         long &nDX, long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData,
-        X11SalGraphics* pNewGraphics)
+        std::unique_ptr<X11SalGraphics> pNewGraphics)
 {
     assert(pNewGraphics);
     if (OpenGLHelper::isVCLOpenGLEnabled())
-        return std::unique_ptr<SalVirtualDevice>(new X11OpenGLSalVirtualDevice( pGraphics, nDX, nDY, pData, pNewGraphics ));
+        return std::unique_ptr<SalVirtualDevice>(new X11OpenGLSalVirtualDevice( pGraphics, nDX, nDY, pData, std::move(pNewGraphics) ));
     else
-        return std::unique_ptr<SalVirtualDevice>(new X11SalVirtualDevice(pGraphics, nDX, nDY, eFormat, pData, pNewGraphics));
+        return std::unique_ptr<SalVirtualDevice>(new X11SalVirtualDevice(pGraphics, nDX, nDY, eFormat, pData, std::move(pNewGraphics)));
 }
 
 std::unique_ptr<SalVirtualDevice> X11SalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
         long &nDX, long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData)
 {
-    return CreateX11VirtualDevice(pGraphics, nDX, nDY, eFormat, pData, new X11SalGraphics());
+    return CreateX11VirtualDevice(pGraphics, nDX, nDY, eFormat, pData, o3tl::make_unique<X11SalGraphics>());
 }
 
 void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap,
@@ -88,8 +89,8 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap,
 
 X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const * pGraphics, long &nDX, long &nDY,
                                          DeviceFormat eFormat, const SystemGraphicsData *pData,
-                                         X11SalGraphics* pNewGraphics) :
-    pGraphics_(pNewGraphics),
+                                         std::unique_ptr<X11SalGraphics> pNewGraphics) :
+    pGraphics_(std::move(pNewGraphics)),
     m_nXScreen(0),
     bGraphics_(false)
 {
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index 3dbf61e06645..134ae11ed0b6 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -338,7 +338,7 @@ std::unique_ptr<SalVirtualDevice> GtkInstance::CreateVirtualDevice( SalGraphics
     GtkSalGraphics *pGtkSalGraphics = dynamic_cast<GtkSalGraphics*>(pG);
     assert(pGtkSalGraphics);
     return CreateX11VirtualDevice(pG, nDX, nDY, eFormat, pGd,
-            new GtkSalGraphics(pGtkSalGraphics->GetGtkFrame(),
+            o3tl::make_unique<GtkSalGraphics>(pGtkSalGraphics->GetGtkFrame(),
                                pGtkSalGraphics->GetGtkWidget(),
                                pGtkSalGraphics->GetScreenNumber()));
 #endif


More information about the Libreoffice-commits mailing list