diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-01-06 12:12:51 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-01-06 15:42:17 +0000 |
commit | 50c9d1f96530c1102dbe24408fa67e64074b9aec (patch) | |
tree | 929839676bdc4f147600b60d6b9152debcba2271 /vcl/inc/opengl/texture.hxx | |
parent | 43de9a5b0f68a77a10595b3f69c6145cd9be05b6 (diff) |
vcl: fix lifecycle errors & memory corruption.
FixedTextureAtlasManager should use ref-counted textures properly.
Also - dispose embedded textures early in VCL shutdown while we have
a valid OpenGLContext.
Also - dispose the native widget control cache earlier too.
Change-Id: Id3f7a1c3b331496616f36cbf02f83737505278a5
Reviewed-on: https://gerrit.libreoffice.org/21148
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/inc/opengl/texture.hxx')
-rw-r--r-- | vcl/inc/opengl/texture.hxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx index 821a649d0e7a..113c65b79e34 100644 --- a/vcl/inc/opengl/texture.hxx +++ b/vcl/inc/opengl/texture.hxx @@ -31,8 +31,8 @@ class ImplOpenGLTexture { -public: int mnRefCount; +public: GLuint mnTexture; int mnWidth; int mnHeight; @@ -46,6 +46,7 @@ public: ImplOpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, void const * pData ); ImplOpenGLTexture( int nX, int nY, int nWidth, int nHeight ); ~ImplOpenGLTexture(); + void Dispose(); bool InsertBuffer(int nX, int nY, int nWidth, int nHeight, int nFormat, int nType, sal_uInt8* pData); @@ -69,11 +70,14 @@ public: if (mpSlotReferences->at(nSlotNumber) == 0) mnFreeSlots++; } + + if (mnRefCount <= 0) + delete this; } - bool ExistRefs() + bool IsUnique() { - return mnRefCount > 0; + return mnRefCount == 1; } bool InitializeSlots(int nSlotSize); |