diff options
| author | 2011-01-27 19:40:24 -0800 | |
|---|---|---|
| committer | 2011-01-27 19:40:24 -0800 | |
| commit | 55f8f12119ad2fbb6afcb7647a1a18f4aa86f0f5 (patch) | |
| tree | acee4470bd15302b011aa912cead59ad34338562 /libs/rs/rsFont.cpp | |
| parent | adc0a5bdd220dab563cb4836989ad6acb1b32189 (diff) | |
| parent | 38f8d9d7a17037a34f4df229b1089536a6cdc8dc (diff) | |
Merge "Correctly free resouces bound to scripts when the scripts are deleted." into honeycomb
Diffstat (limited to 'libs/rs/rsFont.cpp')
| -rw-r--r-- | libs/rs/rsFont.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp index 8571c32e95ec..7fdfbe05f287 100644 --- a/libs/rs/rsFont.cpp +++ b/libs/rs/rsFont.cpp @@ -74,6 +74,15 @@ bool Font::init(const char *name, float fontSize, uint32_t dpi, const void *data return true; } +void Font::preDestroy() const { + for (uint32_t ct = 0; ct < mRSC->mStateFont.mActiveFonts.size(); ct++) { + if (mRSC->mStateFont.mActiveFonts[ct] == this) { + mRSC->mStateFont.mActiveFonts.removeAt(ct); + break; + } + } +} + void Font::invalidateTextureCache() { for (uint32_t i = 0; i < mCachedGlyphs.size(); i ++) { mCachedGlyphs.valueAt(i)->mIsValid = false; @@ -309,13 +318,6 @@ Font::~Font() { FT_Done_Face(mFace); } - for (uint32_t ct = 0; ct < mRSC->mStateFont.mActiveFonts.size(); ct++) { - if (mRSC->mStateFont.mActiveFonts[ct] == this) { - mRSC->mStateFont.mActiveFonts.removeAt(ct); - break; - } - } - for (uint32_t i = 0; i < mCachedGlyphs.size(); i ++) { CachedGlyphInfo *glyph = mCachedGlyphs.valueAt(i); delete glyph; @@ -799,11 +801,6 @@ void FontState::deinit(Context *rsc) { mDefault.clear(); - Vector<Font*> fontsToDereference = mActiveFonts; - for (uint32_t i = 0; i < fontsToDereference.size(); i ++) { - fontsToDereference[i]->zeroUserRef(); - } - if (mLibrary) { FT_Done_FreeType( mLibrary ); mLibrary = NULL; |