fix leak in Deserialize

git-svn-id: http://skia.googlecode.com/svn/trunk@112 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-03-06 15:57:26 +00:00
parent fb12c3e6ba
commit 62533ed6bb
3 changed files with 11 additions and 5 deletions

View File

@ -106,8 +106,16 @@ public:
*/
static SkTypeface* CreateFromStream(SkStream* stream);
// Serialization
/** Write a unique signature to a stream, sufficient to reconstruct a
typeface referencing the same font when Deserialize is called.
*/
void serialize(SkWStream*) const;
/** Given the data previously written by serialize(), return a new instance
to a typeface referring to the same font. If that font is not available,
return null. If an instance is returned, the caller is responsible for
calling unref() when they are done with it.
*/
static SkTypeface* Deserialize(SkStream*);
protected:

View File

@ -50,9 +50,7 @@ void SkTypeface::serialize(SkWStream* stream) const {
}
SkTypeface* SkTypeface::Deserialize(SkStream* stream) {
SkTypeface* face = SkFontHost::Deserialize(stream);
face->ref();
return face;
return SkFontHost::Deserialize(stream);
}

View File

@ -535,7 +535,7 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
}
}
}
return SkFontHost::CreateTypeface(NULL, NULL, (SkTypeface::Style)style);
return NULL;
}
///////////////////////////////////////////////////////////////////////////////