Bug 1201183 - handle font family name OOM error. r=nfroyd
authorJohn Daggett <jdaggett@mozilla.com>
Fri, 11 Sep 2015 09:40:30 +0900
changeset 296199 e1bcc04808cc815f6f4f3f9d8103817ea48ff2a7
parent 296198 0c9269ad0d26c5233e5a90b74a3aa19328ba70e4
child 296200 9680bd9d3a6df8baf46fd655ff34a6b308ead9d1
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [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;