Use share pointer for texture data
Skia tries to do the following:
1. create texture
2. bind texture to framebuffer
3. unbind framebuffer
4. delete texture
5. rebind framebuffer and expect its texture attachment still works.
We would have to rewrite texture data with smart pointers to support
such scenario.
Test: org.skia.skqp.SkQPRunner#UnitTest_GrContext_colorTypeSupportedAsSurface
Bug: 228188395
Change-Id: I0c05da49410080d506767a93983fc8b244f39e99
diff --git a/shared/OpenglCodecCommon/TextureSharedData.h b/shared/OpenglCodecCommon/TextureSharedData.h
index aee1996..fafb435 100644
--- a/shared/OpenglCodecCommon/TextureSharedData.h
+++ b/shared/OpenglCodecCommon/TextureSharedData.h
@@ -18,6 +18,7 @@
#include <GLES/gl.h>
#include <map>
+#include <memory>
#include "android/base/synchronization/AndroidLock.h"
@@ -49,7 +50,7 @@
};
struct SharedTextureDataMap {
- using MapType = std::map<GLuint, TextureRec*>;
+ using MapType = std::map<GLuint, std::shared_ptr<TextureRec>>;
using iterator = MapType::iterator;
using const_iterator = MapType::const_iterator;