Bug 1201183 - handle font family name OOM error. r=nfroyd
authorJohn Daggett <jdaggett@mozilla.com>
Fri, 11 Sep 2015 09:40:30 +0900
changeset 294494 e1bcc04808cc815f6f4f3f9d8103817ea48ff2a7
parent 294493 0c9269ad0d26c5233e5a90b74a3aa19328ba70e4
child 294495 9680bd9d3a6df8baf46fd655ff34a6b308ead9d1
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs1201183
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1201183 - handle font family name OOM error. r=nfroyd
gfx/thebes/gfxDWriteFontList.cpp
--- a/gfx/thebes/gfxDWriteFontList.cpp
+++ b/gfx/thebes/gfxDWriteFontList.cpp
@@ -1516,17 +1516,19 @@ private:
 
 void
 DirectWriteFontInfo::LoadFontFamilyData(const nsAString& aFamilyName)
 {
     // lookup the family
     nsAutoTArray<wchar_t, 32> famName;
 
     uint32_t len = aFamilyName.Length();
-    famName.SetLength(len + 1, fallible);
+    if(!famName.SetLength(len + 1, fallible)) {
+        return;
+    }
     memcpy(famName.Elements(), aFamilyName.BeginReading(), len * sizeof(char16_t));
     famName[len] = 0;
 
     HRESULT hr;
     BOOL exists = false;
 
     uint32_t index;
     nsRefPtr<IDWriteFontFamily> family;