diff options
-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; |