Changeset 147681 in webkit


Ignore:
Timestamp:
Apr 4, 2013 4:56:13 PM (11 years ago)
Author:
Christophe Dumez
Message:

Regression(r147639) Causes assertion hit in HashTable
https://bugs.webkit.org/show_bug.cgi?id=113954

Reviewed by Benjamin Poulain.

Lookup the key in the hash table again after the recursive call to
getCachedFontPlatformData() as it may have altered the hash map and
invalidated the previous iterator we had.

No new tests, covered by existing tests.

  • platform/graphics/FontCache.cpp:

(WebCore::FontCache::getCachedFontPlatformData):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147675 r147681  
     12013-04-04  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        Regression(r147639) Causes assertion hit in HashTable
     4        https://bugs.webkit.org/show_bug.cgi?id=113954
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Lookup the key in the hash table again after the recursive call to
     9        getCachedFontPlatformData() as it may have altered the hash map and
     10        invalidated the previous iterator we had.
     11
     12        No new tests, covered by existing tests.
     13
     14        * platform/graphics/FontCache.cpp:
     15        (WebCore::FontCache::getCachedFontPlatformData):
     16
    1172013-04-04  Eric Carlson  <eric.carlson@apple.com>
    218
  • trunk/Source/WebCore/platform/graphics/FontCache.cpp

    r147639 r147681  
    203203
    204204    FontPlatformDataCache::AddResult result = gFontPlatformDataCache->add(key, nullptr);
     205    FontPlatformDataCache::iterator it = result.iterator;
    205206    if (result.isNewEntry) {
    206         result.iterator->value = createFontPlatformData(fontDescription, familyName);
    207 
    208         if (!result.iterator->value && !checkingAlternateName) {
     207        it->value = createFontPlatformData(fontDescription, familyName);
     208
     209        if (!it->value && !checkingAlternateName) {
    209210            // We were unable to find a font.  We have a small set of fonts that we alias to other names,
    210211            // e.g., Arial/Helvetica, Courier/Courier New, etc.  Try looking up the font under the aliased name.
     
    212213            if (!alternateName.isEmpty()) {
    213214                FontPlatformData* fontPlatformDataForAlternateName = getCachedFontPlatformData(fontDescription, alternateName, true);
     215                // Lookup the key in the hash table again as the previous iterator may have
     216                // been invalidated by the recursive call to getCachedFontPlatformData().
     217                it = gFontPlatformDataCache->find(key);
     218                ASSERT(it != gFontPlatformDataCache->end());
    214219                if (fontPlatformDataForAlternateName)
    215                     result.iterator->value = adoptPtr(new FontPlatformData(*fontPlatformDataForAlternateName));
     220                    it->value = adoptPtr(new FontPlatformData(*fontPlatformDataForAlternateName));
    216221            }
    217222        }
    218223    }
    219224
    220     return result.iterator->value.get();
     225    return it->value.get();
    221226}
    222227
Note: See TracChangeset for help on using the changeset viewer.