[Webkit-unassigned] [Bug 15914] [GTK] Implement Unicode functionality using GLib

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Nov 24 12:27:13 PST 2008


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





------- Comment #45 from zuh at iki.fi  2008-11-24 12:27 PDT -------
(In reply to comment #39)
> Kalle, if you have some time, could have a go with this one? Any feedback is
> welcome. 

I took it for a spin, and visually it worked for me :)

Valgrind disagreed though, there were two leaks introduced. Fortunately fixing
those was trivial:

--- a/WebCore/platform/graphics/gtk/FontGtk.cpp
+++ b/WebCore/platform/graphics/gtk/FontGtk.cpp
@@ -139,6 +139,7 @@ static gchar* convertUniCharToUTF8(const UChar* characters,
gint length, int fro
         pos += start;
         len -= start;
     }
+    g_free(utf8);
     return g_string_free(ret, FALSE);
 }

The contents of utf8 is appended to a gstring which copies the data, so the
original needs to be freed.

--- a/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp
+++ b/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp
@@ -67,6 +67,8 @@ static TextBreakIterator* setUpIterator(bool&
createdIterator, TextBreakIterator

     iterator->m_type = type;
     iterator->m_length = length;
+    if (createdIterator)
+       g_free(iterator->m_log_attrs);
     iterator->m_log_attrs = g_new0(PangoLogAttr, length + 1);
     iterator->m_index = -1;
     pango_get_log_attrs(utf8.get(), utf8len, -1, 0, iterator->m_log_attrs,
length + 1);

Here the PangoLogAttr array was leaked for each setup after the first one.
Since this seems to be done a lot, I wonder if using the g_slice API would be a
good idea performance-wise... That would require profiling to prove it's
hurting though.


-- 
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