Bug 1246889 - Correctly check whether hb_blob_create failed in ShareTableAndGetBlob. r=jfkthame
authorBogdan Postelnicu <bogdan.postelnicu@softvision.ro>
Wed, 10 Feb 2016 16:47:02 +0200
changeset 330106 2ee5ba0e786c5b6e0e55a9cbe69be590fd9ba925
parent 330105 ae350a962463f7611da73f156665cffd2051dbfd
child 330107 2064cff635eb6e40579a42a704da38f4117ee488
push id10675
push userbmo:james@hoppipolla.co.uk
push dateWed, 10 Feb 2016 15:13:04 +0000
reviewersjfkthame
bugs1246889
milestone47.0a1
Bug 1246889 - Correctly check whether hb_blob_create failed in ShareTableAndGetBlob. r=jfkthame MozReview-Commit-ID: EMsr5uipjjL
gfx/thebes/gfxFontEntry.cpp
--- a/gfx/thebes/gfxFontEntry.cpp
+++ b/gfx/thebes/gfxFontEntry.cpp
@@ -585,21 +585,22 @@ private:
 hb_blob_t *
 gfxFontEntry::FontTableHashEntry::
 ShareTableAndGetBlob(nsTArray<uint8_t>&& aTable,
                      nsTHashtable<FontTableHashEntry> *aHashtable)
 {
     Clear();
     // adopts elements of aTable
     mSharedBlobData = new FontTableBlobData(Move(aTable));
+
     mBlob = hb_blob_create(mSharedBlobData->GetTable(),
                            mSharedBlobData->GetTableLength(),
                            HB_MEMORY_MODE_READONLY,
                            mSharedBlobData, DeleteFontTableBlobData);
-    if (!mSharedBlobData) {
+    if (mBlob == hb_blob_get_empty() ) {
         // The FontTableBlobData was destroyed during hb_blob_create().
         // The (empty) blob is still be held in the hashtable with a strong
         // reference.
         return hb_blob_reference(mBlob);
     }
 
     // Tell the FontTableBlobData to remove this hash entry when destroyed.
     // The hashtable does not keep a strong reference.