diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-04-12 20:16:49 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-04-12 20:16:49 +0000 |
commit | 1c0c5a0a52d0d94653c6ca959a43226228a5ca08 (patch) | |
tree | 6520a9bab94e89e52e249641da68118f17d048ac /src/ports | |
parent | 6413e79414b4a8e4111cfd4c35959d10d9312440 (diff) |
fix refcnt for streams
git-svn-id: http://skia.googlecode.com/svn/trunk@540 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontHost_linux.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp index 08fd76eac3..62feef3ca1 100644 --- a/src/ports/SkFontHost_linux.cpp +++ b/src/ports/SkFontHost_linux.cpp @@ -283,10 +283,11 @@ public: StreamTypeface(Style style, bool sysFont, FamilyRec* family, SkStream* stream) : INHERITED(style, sysFont, family) { + stream->ref(); fStream = stream; } virtual ~StreamTypeface() { - SkDELETE(fStream); + fStream->unref(); } // overrides @@ -536,8 +537,8 @@ SkStream* SkFontHost::OpenStream(uint32_t fontID) { FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID); SkStream* stream = tf ? tf->openStream() : NULL; - if (NULL == stream || stream->getLength() == 0) { - delete stream; + if (stream && stream->getLength() == 0) { + stream->unref(); stream = NULL; } return stream; |