[Webkit-unassigned] [Bug 57307] [GTK] Fix leaked pointer in FontGtk.cpp

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 30 18:14:22 PDT 2011


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





--- Comment #8 from Ryuan Choi <ryuan.choi at samsung.com>  2011-03-30 18:14:21 PST ---
(In reply to comment #6)
> (From update of attachment 87452 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=87452&action=review
> 
> This code probably needs quite a bit more cleanup in the future, but this is a good incremental change. Please make the following changes before landing.
> 
> > Source/WebCore/platform/graphics/gtk/FontGtk.cpp:92
> >      for (i = 0; i < aLength; i++) {
> 
> Moving the declaration of i here would be more idiomatic in C++.
Done.

> 
> > Source/WebCore/platform/graphics/gtk/FontGtk.cpp:135
> > +        g_free((gpointer)aText);
> 
> You do not need to cast here.

Because aText is const variable, I couldn't remove casting.
Instead, I removed g_free itself using GOwnPtr.

> 
> > Source/WebCore/platform/graphics/gtk/FontGtk.cpp:142
> >      gint new_length = 0;
> 
> new_length --> newLength;
> 
Done.

> > Source/WebCore/platform/graphics/gtk/FontGtk.cpp:154
> >      if (from > 0) {
> >          // discard the first 'from' characters
> >          // FIXME: we should do this before the conversion probably
> > -        gchar* str_left = g_utf8_offset_to_pointer(utf8, from);
> > -        gchar* tmp = g_strdup(str_left);
> > -        g_free(utf8);
> > -        utf8 = tmp;
> > +        gchar* strLeft = g_utf8_offset_to_pointer(utf8Text.get(), from);
> > +        utf8Text.set(g_strdup(strLeft));
> >      }
> >  
> > -    gchar* pos = utf8;
> > +    gchar* pos = utf8Text.get();
> 
> I think you can easily optimize this section by doing something like:
> 
> gchar* pos = utf8Text.get();
> if (from > 0) {
>     // FIXME: we should do this before the conversion probably
>     pos = g_utf8_offset_to_pointer(pos, from);
> }
Done.

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



More information about the webkit-unassigned mailing list