diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-01-04 21:51:28 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-01-07 09:09:09 +0000 |
commit | ab1eed777a2e5fa94fdde1cc8260cf8ad264c145 (patch) | |
tree | 3bd336ada2306465f0b4786a56925d1292ccbe5d /vcl/inc | |
parent | 59903419ab177402cc394e282bf24cf05f8f3441 (diff) |
tdf#96894 - get ordering right for TextureAtlas cleanup on shutdown.
Do it much earlier - while we have a valid OpenGLContext.
FixedTextureAtlasManager should also 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: Ie258283147d02984b6f507c0075d114ae7288051
Reviewed-on: https://gerrit.libreoffice.org/21089
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/21119
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/opengl/FixedTextureAtlas.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/opengl/texture.hxx | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/vcl/inc/opengl/FixedTextureAtlas.hxx b/vcl/inc/opengl/FixedTextureAtlas.hxx index 362714005585..5b22b619d945 100644 --- a/vcl/inc/opengl/FixedTextureAtlas.hxx +++ b/vcl/inc/opengl/FixedTextureAtlas.hxx @@ -16,7 +16,7 @@ class VCL_PLUGIN_PUBLIC FixedTextureAtlasManager { - std::vector<std::unique_ptr<ImplOpenGLTexture>> mpTextures; + std::vector<ImplOpenGLTexture *> mpTextures; int mWidthFactor; int mHeightFactor; @@ -26,6 +26,7 @@ class VCL_PLUGIN_PUBLIC FixedTextureAtlasManager public: FixedTextureAtlasManager(int nWidthFactor, int nHeightFactor, int nTextureSize); + ~FixedTextureAtlasManager(); OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8* pData); int GetSubtextureSize() diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx index e57aa9e32306..938891848ab7 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; @@ -47,6 +47,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); @@ -70,11 +71,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); |