diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-21 15:29:27 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-21 15:29:27 +0000 |
commit | 7b578928a5705f40cfe051ae1c41c1b2e1df0bdd (patch) | |
tree | 0f4f3b3e57700e0cbfd75dc2755716a306016836 /src/core | |
parent | b6a4b7363faaf57e7dc123b040346e45c0efc9ea (diff) |
~glyphcache_globals needs to actually delete its cache
git-svn-id: http://skia.googlecode.com/svn/trunk@4011 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkGlyphCache.cpp | 7 | ||||
-rwxr-xr-x | src/core/SkTLS.cpp | 25 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index a6eea7733f..f3363cde70 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -432,6 +432,13 @@ public: } ~SkGlyphCache_Globals() { + SkGlyphCache* cache = fHead; + while (cache) { + SkGlyphCache* next = cache->fNext; + SkDELETE(cache); + cache = next; + } + SkDELETE(fMutex); } diff --git a/src/core/SkTLS.cpp b/src/core/SkTLS.cpp index b31a666a91..2d84d6b23d 100755 --- a/src/core/SkTLS.cpp +++ b/src/core/SkTLS.cpp @@ -1,20 +1,45 @@ #include "SkTLS.h" +// enable to help debug TLS storage +//#define SK_TRACE_TLS_LIFETIME + + +#ifdef SK_TRACE_TLS_LIFETIME + #include "SkThread.h" + static int32_t gTLSRecCount; +#endif + struct SkTLSRec { SkTLSRec* fNext; void* fData; SkTLS::CreateProc fCreateProc; SkTLS::DeleteProc fDeleteProc; +#ifdef SK_TRACE_TLS_LIFETIME + SkTLSRec() { + int n = sk_atomic_inc(&gTLSRecCount); + SkDebugf(" SkTLSRec[%d]\n", n); + } +#endif + ~SkTLSRec() { if (fDeleteProc) { fDeleteProc(fData); } // else we leak fData, or it will be managed by the caller + +#ifdef SK_TRACE_TLS_LIFETIME + int n = sk_atomic_dec(&gTLSRecCount); + SkDebugf("~SkTLSRec[%d]\n", n - 1); +#endif } }; void SkTLS::Destructor(void* ptr) { +#ifdef SK_TRACE_TLS_LIFETIME + SkDebugf("SkTLS::Destructor(%p)\n", ptr); +#endif + SkTLSRec* rec = (SkTLSRec*)ptr; do { SkTLSRec* next = rec->fNext; |