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

Caolán McNamara caolanm at redhat.com
Mon May 9 10:30:03 UTC 2016


 vcl/opengl/PackedTextureAtlas.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 6e970c11645f1a05638e49da9e2911fe59628838
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 6 21:12:05 2016 +0100

    cid#1358836 reorganize to silence Resource leak in object
    
    Change-Id: I4cb51f537cf6b40748dd8902dc39362d8846ba22
    Reviewed-on: https://gerrit.libreoffice.org/24708
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/opengl/PackedTextureAtlas.cxx b/vcl/opengl/PackedTextureAtlas.cxx
index c2e1244..38475b1 100644
--- a/vcl/opengl/PackedTextureAtlas.cxx
+++ b/vcl/opengl/PackedTextureAtlas.cxx
@@ -109,7 +109,7 @@ Node* Node::insert(int nWidth, int nHeight, int nPadding)
 
 struct PackedTexture
 {
-    ImplOpenGLTexture* mpTexture;
+    std::unique_ptr<ImplOpenGLTexture> mpTexture;
     std::unique_ptr<Node> mpRootNode;
     int mnDeallocatedArea;
 
@@ -131,7 +131,7 @@ PackedTextureAtlasManager::~PackedTextureAtlasManager()
     for (std::unique_ptr<PackedTexture>& pPackedTexture : maPackedTextures)
     {
         // Free texture early in VCL shutdown while we have a context.
-        delete pPackedTexture->mpTexture;
+        pPackedTexture->mpTexture.reset();
     }
 }
 
@@ -151,7 +151,7 @@ OpenGLTexture PackedTextureAtlasManager::Reserve(int nWidth, int nHeight)
         Node* pNode = pPackedTexture->mpRootNode->insert(nWidth, nHeight, 1);
         if (pNode != nullptr)
         {
-            return OpenGLTexture(pPackedTexture->mpTexture, pNode->mRectangle, -1);
+            return OpenGLTexture(pPackedTexture->mpTexture.get(), pNode->mRectangle, -1);
         }
     }
     CreateNewTexture();
@@ -159,7 +159,7 @@ OpenGLTexture PackedTextureAtlasManager::Reserve(int nWidth, int nHeight)
     Node* pNode = pPackedTexture->mpRootNode->insert(nWidth, nHeight, 1);
     if (pNode != nullptr)
     {
-        return OpenGLTexture(pPackedTexture->mpTexture, pNode->mRectangle, -1);
+        return OpenGLTexture(pPackedTexture->mpTexture.get(), pNode->mRectangle, -1);
     }
     return OpenGLTexture();
 }


More information about the Libreoffice-commits mailing list