WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
proposed patch
general-withcl.3.patch (text/plain), 4.52 KB, created by
Balazs Kelemen
on 2009-04-01 06:15:52 PDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Balazs Kelemen
Created:
2009-04-01 06:15:52 PDT
Size:
4.52 KB
patch
obsolete
>diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index 637bf11..429ad3f 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,32 @@ >+2009-03-31 Balazs Kelemen <kelemen.balazs@stud.u-szeged.hu> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://bugs.webkit.org/show_bug.cgi?id=24551 >+ [Qt] leaks in font-handling >+ >+ Break with creating new objects for return value >+ of functions in the case when the caller does >+ not expect that ownership is passed. >+ No change in behavior so no test. >+ >+ * platform/graphics/qt/FontCacheQt.cpp: >+ (WebCore::FontCache::getCachedFontPlatformData): Return with 0 >+ instead of returning with a new object. This is a logical change >+ because Qt does not have a real FontCache. >+ * platform/graphics/qt/FontFallbackListQt.cpp: >+ (WebCore::FontFallbackList::invalidate): Avoid purge m_fontList >+ because it can be referenced by Font objects. >+ (WebCore::FontFallbackList::releaseFontData): Purge m_fontList. >+ This is only called from the destructor. >+ (WebCore::FontFallbackList::fontDataAt): Hold the created >+ SimpleFontData in m_fontList instead of creating a new one >+ on every call. >+ * css/CSSFontFaceSource.cpp: >+ (WebCore::CSSFontFaceSource::getFontData): Add a necessary >+ null pointer check and create a new FontPlatformData if it >+ was true. It is needed because of the change in FontCacheQt.cpp. >+ > 2009-03-31 Rafael Weinstein <rafaelw@chromium.org> > > Reviewed by Eric Seidel. >diff --git a/WebCore/css/CSSFontFaceSource.cpp b/WebCore/css/CSSFontFaceSource.cpp >index 111cea2..0ca2290 100644 >--- a/WebCore/css/CSSFontFaceSource.cpp >+++ b/WebCore/css/CSSFontFaceSource.cpp >@@ -180,8 +180,11 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri > m_font->beginLoadIfNeeded(docLoader); > // FIXME: m_string is a URL so it makes no sense to pass it as a family name. > FontPlatformData* tempData = fontCache()->getCachedFontPlatformData(fontDescription, m_string); >- if (!tempData) >+ if (!tempData) { > tempData = fontCache()->getLastResortFallbackFont(fontDescription); >+ if (!tempData) >+ tempData = new FontPlatformData(fontDescription); >+ } > fontData.set(new SimpleFontData(*tempData, true, true)); > } > >diff --git a/WebCore/platform/graphics/qt/FontCacheQt.cpp b/WebCore/platform/graphics/qt/FontCacheQt.cpp >index 114f073..cf724a7 100644 >--- a/WebCore/platform/graphics/qt/FontCacheQt.cpp >+++ b/WebCore/platform/graphics/qt/FontCacheQt.cpp >@@ -46,7 +46,7 @@ void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigne > > FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& description, const AtomicString& family, bool checkingAlternateName) > { >- return new FontPlatformData(description); >+ return 0; > } > > SimpleFontData* FontCache::getCachedFontData(const FontPlatformData*) >diff --git a/WebCore/platform/graphics/qt/FontFallbackListQt.cpp b/WebCore/platform/graphics/qt/FontFallbackListQt.cpp >index 22ae205..f365df7 100644 >--- a/WebCore/platform/graphics/qt/FontFallbackListQt.cpp >+++ b/WebCore/platform/graphics/qt/FontFallbackListQt.cpp >@@ -42,8 +42,6 @@ FontFallbackList::FontFallbackList() > > void FontFallbackList::invalidate(WTF::PassRefPtr<WebCore::FontSelector> fontSelector) > { >- releaseFontData(); >- m_fontList.clear(); > m_familyIndex = 0; > m_pitch = UnknownPitch; > m_loadingCustomFonts = false; >@@ -53,6 +51,8 @@ void FontFallbackList::invalidate(WTF::PassRefPtr<WebCore::FontSelector> fontSel > > void FontFallbackList::releaseFontData() > { >+ if (m_fontList.size()) >+ delete m_fontList[0].first; > } > > void FontFallbackList::determinePitch(const WebCore::Font* font) const >@@ -90,7 +90,12 @@ const FontData* FontFallbackList::fontDataAt(const WebCore::Font* _font, unsigne > family = family->next(); > } > >- return new SimpleFontData(FontPlatformData(description), _font->wordSpacing(), _font->letterSpacing()); >+ if (!m_fontList.size()) { >+ const FontData* result = new SimpleFontData(FontPlatformData(description), _font->wordSpacing(), _font->letterSpacing()); >+ m_fontList.append(pair<const FontData*, bool>(result, result->isCustomFont())); >+ return result; >+ } else >+ return m_fontList[0].first; > } > > const FontData* FontFallbackList::fontDataForCharacters(const WebCore::Font* font, const UChar*, int) const
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 24551
:
28536
|
28684
|
28928
|
28931
|
28966
|
29158
|
29228
|
29277
|
29815
|
29816