Don't leak GlyphAtlas textures (fixes #2338)

This commit is contained in:
John Firebaugh
2015-09-15 17:48:07 -07:00
parent 620e554f67
commit d83be11947
2 changed files with 12 additions and 0 deletions

View File

@@ -5,6 +5,8 @@
#include <mbgl/platform/gl.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/platform/platform.hpp>
#include <mbgl/util/gl_object_store.hpp>
#include <mbgl/util/thread_context.hpp>
#include <cassert>
#include <algorithm>
@@ -20,6 +22,15 @@ GlyphAtlas::GlyphAtlas(uint16_t width_, uint16_t height_)
dirty(true) {
}
GlyphAtlas::~GlyphAtlas() {
assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
if (texture) {
mbgl::util::ThreadContext::getGLObjectStore()->abandonTexture(texture);
texture = 0;
}
}
void GlyphAtlas::addGlyphs(uintptr_t tileUID,
const std::u32string& text,
const std::string& stackName,

View File

@@ -17,6 +17,7 @@ namespace mbgl {
class GlyphAtlas : public util::noncopyable {
public:
GlyphAtlas(uint16_t width, uint16_t height);
~GlyphAtlas();
void addGlyphs(uintptr_t tileUID,
const std::u32string& text,