Changeset 41762 in webkit
- Timestamp:
- Mar 17, 2009 7:43:32 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r41761 r41762 1 2009-03-16 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Holger Freyther. 4 5 https://bugs.webkit.org/show_bug.cgi?id=24592 6 [GTK] Crash in FcPatternHash 7 8 Sanitize memory management in gtk fonts. 9 10 Release memory allocated by FontPlatformDataGtk in its own 11 destructor instead of doing it from other classes, and add copy 12 constructor and '=' operator to be able to track referenced 13 objects properly. 14 15 * platform/graphics/gtk/FontPlatformData.h: 16 * platform/graphics/gtk/FontPlatformDataGtk.cpp: 17 (WebCore::FontPlatformData::operator=): 18 (WebCore::FontPlatformData::FontPlatformData): 19 (WebCore::FontPlatformData::~FontPlatformData): 20 * platform/graphics/gtk/SimpleFontDataGtk.cpp: 21 (WebCore::SimpleFontData::platformDestroy): 22 1 23 2009-03-17 Ariya Hidayat <ariya.hidayat@nokia.com> 2 24 -
trunk/WebCore/platform/graphics/gtk/FontPlatformData.h
r36309 r41762 75 75 FontPlatformData(float size, bool bold, bool italic); 76 76 FontPlatformData(cairo_font_face_t* fontFace, int size, bool bold, bool italic); 77 FontPlatformData(const FontPlatformData&); 77 78 78 79 ~FontPlatformData(); … … 96 97 97 98 bool operator==(const FontPlatformData&) const; 99 FontPlatformData& operator=(const FontPlatformData&); 98 100 bool isHashTableDeletedValue() const { 99 101 #if defined(USE_FREETYPE) -
trunk/WebCore/platform/graphics/gtk/FontPlatformDataGtk.cpp
r36309 r41762 4 4 * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com> 5 5 * Copyright (C) 2007 Holger Hans Peter Freyther 6 * Copyright (C) 2009 Igalia S.L. 6 7 * All rights reserved. 7 8 * … … 162 163 } 163 164 165 FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other) 166 { 167 // Check for self-assignment. 168 if (this == &other) 169 return *this; 170 171 m_size = other.m_size; 172 m_syntheticBold = other.m_syntheticBold; 173 m_syntheticOblique = other.m_syntheticOblique; 174 175 if (other.m_scaledFont) 176 cairo_scaled_font_reference (other.m_scaledFont); 177 if (m_scaledFont) 178 cairo_scaled_font_destroy(m_scaledFont); 179 m_scaledFont = other.m_scaledFont; 180 181 if (other.m_pattern) 182 FcPatternReference(other.m_pattern); 183 if (m_pattern) 184 FcPatternDestroy(m_pattern); 185 m_pattern = other.m_pattern; 186 187 if (m_fallbacks) { 188 FcFontSetDestroy(m_fallbacks); 189 // This will be re-created on demand. 190 m_fallbacks = 0; 191 } 192 193 return *this; 194 } 195 196 FontPlatformData::FontPlatformData(const FontPlatformData& other) 197 : m_pattern(0) 198 , m_fallbacks(0) 199 , m_scaledFont(0) 200 { 201 *this = other; 202 } 203 164 204 bool FontPlatformData::init() 165 205 { … … 177 217 FontPlatformData::~FontPlatformData() 178 218 { 219 if (m_pattern && ((FcPattern*)-1 != m_pattern)) { 220 FcPatternDestroy(m_pattern); 221 m_pattern = 0; 222 } 223 224 if (m_fallbacks) { 225 FcFontSetDestroy(m_fallbacks); 226 m_fallbacks = 0; 227 } 228 229 if (m_scaledFont) { 230 cairo_scaled_font_destroy(m_scaledFont); 231 m_scaledFont = 0; 232 } 179 233 } 180 234 -
trunk/WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp
r41246 r41762 65 65 delete m_smallCapsFontData; 66 66 m_smallCapsFontData = 0; 67 68 if (isCustomFont())69 return;70 71 if (m_font.m_pattern && ((FcPattern*)-1 != m_font.m_pattern)) {72 FcPatternDestroy(m_font.m_pattern);73 m_font.m_pattern = 0;74 }75 76 if (m_font.m_fallbacks) {77 FcFontSetDestroy(m_font.m_fallbacks);78 m_font.m_fallbacks = 0;79 }80 81 if (m_font.m_scaledFont) {82 cairo_scaled_font_destroy(m_font.m_scaledFont);83 m_font.m_scaledFont = 0;84 }85 67 } 86 68
Note: See TracChangeset
for help on using the changeset viewer.