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

Jan Holesovsky kendy at collabora.com
Thu Nov 20 11:59:21 PST 2014


 vcl/win/source/gdi/salnativewidgets-luna.cxx |    9 ++-------
 vcl/win/source/gdi/winlayout.cxx             |    3 +--
 2 files changed, 3 insertions(+), 9 deletions(-)

New commits:
commit be5ef396a54da1a8aa4b9c23b43496f1f407e447
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Nov 20 19:12:16 2014 +0100

    boost::scoped_ptr instead of manual pointer lifecycle management.
    
    Change-Id: I3b518065cead1c2805662326f063cb7b24d3d52a

diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index 8c87710..0789d4c 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -1288,23 +1288,18 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
         if (ImplDrawNativeControl(aBlackDC.getCompatibleHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr) &&
             ImplDrawNativeControl(aWhiteDC.getCompatibleHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr))
         {
-            OpenGLTexture *pBlackTexture = aBlackDC.getTexture();
+            boost::scoped_ptr<OpenGLTexture> pBlackTexture(aBlackDC.getTexture());
             if (!pBlackTexture)
                 return false;
 
-            OpenGLTexture *pWhiteTexture = aWhiteDC.getTexture();
+            boost::scoped_ptr<OpenGLTexture> pWhiteTexture(aWhiteDC.getTexture());
             if (!pWhiteTexture)
-            {
-                delete pBlackTexture;
                 return false;
-            }
 
             pImpl->PreDraw();
             pImpl->DrawTexture(*pBlackTexture, aBlackDC.getTwoRect()); // FIXME combine the textures - DrawTextureSynthesizedAlpha()
             pImpl->PostDraw();
 
-            delete pBlackTexture;
-            delete pWhiteTexture;
             bOk = true;
         }
     }
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 3778db3..e405e49 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -218,13 +218,12 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
         WinOpenGLSalGraphicsImpl *pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(rWinGraphics.mpImpl.get());
         if (pImpl)
         {
-            OpenGLTexture *pTexture = aDC.getTexture();
+            boost::scoped_ptr<OpenGLTexture> pTexture(aDC.getTexture());
             if (pTexture)
             {
                 pImpl->PreDraw();
                 pImpl->DrawMask(*pTexture, salColor, aDC.getTwoRect());
                 pImpl->PostDraw();
-                delete pTexture;
             }
         }
     }


More information about the Libreoffice-commits mailing list