Oops, CreateTypeface takes over ownership of the stream, instead of just ref()
authorreed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 20 Feb 2009 21:11:40 +0000 (21:11 +0000)
committerreed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 20 Feb 2009 21:11:40 +0000 (21:11 +0000)
This should be changed, for until it is, fix CreateTypefaceFromFile to not call
unref() if the typeface got created.

git-svn-id: http://skia.googlecode.com/svn/trunk@94 2bbb7eff-a529-9590-31e7-b0007b416f81

src/ports/SkFontHost_linux.cpp

index 561b7df234543deae4c889801a5a790368977faa..a7cda527892d6cadd25cd2e1cf8e0e03e5a521a5 100644 (file)
@@ -577,10 +577,10 @@ SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
     SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path));
 
     if (stream->isValid()) {
-        face = CreateTypeface(stream);
+        return CreateTypeface(stream);
     }
     stream->unref();
-    return face;
+    return NULL;
 }
 
 ///////////////////////////////////////////////////////////////////////////////