Commit 2abb72c8 authored by Jonathan Kew's avatar Jonathan Kew
Browse files

Bug 1835110 - Avoid potential deadlock in FT2FontEntry::HasFontTable. r=gfx-reviewers,bradwerth

Checking logcat from test runs at
https://treeherder.mozilla.org/jobs?repo=try&revision=fc75475d3cd5dcacbbc74b0c9a58a89ae6c97119
we can see that the "potential deadlock" warning no longer appears.

Differential Revision: https://phabricator.services.mozilla.com/D179118
parent f8d5019d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -492,7 +492,14 @@ hb_face_t* FT2FontEntry::CreateHBFace() const {
}

bool FT2FontEntry::HasFontTable(uint32_t aTableTag) {
  // If we already have a FreeType face, we can just use that.
  if (mFTFace) {
    RefPtr<SharedFTFace> face = GetFTFace();
    return gfxFT2FontEntryBase::FaceHasTable(face, aTableTag);
  }

  {
    // If we have a cached set of tables, query that.
    AutoReadLock lock(mLock);
    if (mAvailableTables.Count() > 0) {
      return mAvailableTables.Contains(aTableTag);
@@ -530,6 +537,8 @@ bool FT2FontEntry::HasFontTable(uint32_t aTableTag) {
    return mAvailableTables.Contains(aTableTag);
  }

  // Last resort: we'll have to create a (temporary) FreeType face to query
  // for table presence.
  RefPtr<SharedFTFace> face = GetFTFace();
  return gfxFT2FontEntryBase::FaceHasTable(face, aTableTag);
}