[Webkit-unassigned] [Bug 24592] [GTK] Crash in FcPatternHash

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 16 22:35:37 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=24592





------- Comment #5 from zecke at selfish.org  2009-03-16 22:35 PDT -------
(From update of attachment 28653)
>         * platform/graphics/gtk/FontPlatformData.h:
>         * platform/graphics/gtk/FontPlatformDataGtk.cpp:


FontPlatformDataPango.cpp needs some love too?


> +FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
> +{
> +    m_size = other.m_size;
> +    m_syntheticBold = other.m_syntheticBold;
> +    m_syntheticOblique = other.m_syntheticOblique;
> +    if (other.m_scaledFont)
> +        m_scaledFont = cairo_scaled_font_reference (other.m_scaledFont);
> +    else
> +        m_scaledFont = 0;
> +
> +    if (other.m_pattern)
> +        FcPatternReference(other.m_pattern);
> +    m_pattern = other.m_pattern;
> +
> +    // This will be re-created on demand.
> +    m_fallbacks = 0;

This is not correct. FontPlatformData might already have a properly initialized
m_scaledFont and m_pattern. This means the normal flow of things are. Ref the
new stuff, unref the old stuff, copy over the pointers. This makes sure you
don't lead and guards you against self assignment (fontData = fontData). And in
case of the self assignment you reset m_fallbacks without freeing it...

A incomplete pointer:
http://www.codingstandard.com/HICPPCM/High_Integrity_CPP_Rule_3.1.5.html


> +FontPlatformData::FontPlatformData(const FontPlatformData& other)
> +{
       *this = other;

to avoid the code duplication.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list