Bug 379433 - PangoItem and GList memory leaks in gfxPangoFonts

p=Karl Tomlinson <mozbugz@karlt.net>
r=vlad
This commit is contained in:
asqueella%gmail.com 2007-05-04 06:51:04 +00:00
Родитель 326c0fff20
Коммит ae7e6769af
1 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -1573,23 +1573,27 @@ gfxPangoFontGroup::CreateGlyphRunsItemizing(gfxTextRun *aTextRun,
PRUint32 utf16Offset = 0; PRUint32 utf16Offset = 0;
PRBool isRTL = aTextRun->IsRightToLeft(); PRBool isRTL = aTextRun->IsRightToLeft();
for (; items && items->data; items = items->next) { GList *pos = items;
PangoItem *item = (PangoItem *)items->data; for (; pos && pos->data; pos = pos->next) {
PangoItem *item = (PangoItem *)pos->data;
NS_ASSERTION(isRTL == item->analysis.level % 2, "RTL assumption mismatch"); NS_ASSERTION(isRTL == item->analysis.level % 2, "RTL assumption mismatch");
PRUint32 offset = item->offset; PRUint32 offset = item->offset;
PRUint32 length = item->length; PRUint32 length = item->length;
if (offset < aUTF8HeaderLen) { if (offset < aUTF8HeaderLen) {
if (offset + length <= aUTF8HeaderLen) if (offset + length <= aUTF8HeaderLen) {
continue; pango_item_free(item);
length -= aUTF8HeaderLen - offset; continue;
offset = aUTF8HeaderLen; }
length -= aUTF8HeaderLen - offset;
offset = aUTF8HeaderLen;
} }
SetupClusterBoundaries(aTextRun, aUTF8 + offset, length, utf16Offset, &item->analysis); SetupClusterBoundaries(aTextRun, aUTF8 + offset, length, utf16Offset, &item->analysis);
FontSelector fs(aUTF8 + offset, length, this, aTextRun, item, utf16Offset, isRTL); FontSelector fs(aUTF8 + offset, length, this, aTextRun, item, utf16Offset, isRTL);
fs.Run(); // appends GlyphRuns fs.Run(); // appends GlyphRuns
utf16Offset = fs.GetUTF16Offset(); utf16Offset = fs.GetUTF16Offset();
pango_item_free(item);
} }
NS_ASSERTION(utf16Offset == aTextRun->GetLength(), NS_ASSERTION(utf16Offset == aTextRun->GetLength(),