Changeset 154953 in webkit


Ignore:
Timestamp:
Sep 2, 2013 7:40:54 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[ATK] Leak: Leaks in testatk.c
https://bugs.webkit.org/show_bug.cgi?id=118675

Patch by Brian Holt <brian.holt@samsung.com> on 2013-09-02
Reviewed by Mario Sanchez Prada.

Fixed memory leaks by matching ref calls with unrefs.

  • tests/testatk.c:

(testWebkitAtkCaretOffsets):
(testWebkitAtkCaretOffsetsAndExtranousWhiteSpaces):
(testWebkitAtkGetTextAtOffset):
(testWebkitAtkGetTextAtOffsetNewlines):
(testWebkitAtkGetTextAtOffsetTextarea):
(testWebkitAtkGetTextAtOffsetTextInput):
(testWebkitAtkGetTextInParagraphAndBodySimple):
(testWebkitAtkGetTextInParagraphAndBodyModerate):
(testWebkitAtkTextAttributes):
(testWebkitAtkTextSelections):
(testWebkitAtkListsOfItems):

Location:
trunk/Source/WebKit/gtk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/gtk/ChangeLog

    r154830 r154953  
     12013-09-02  Brian Holt  <brian.holt@samsung.com>
     2
     3        [ATK] Leak: Leaks in testatk.c
     4        https://bugs.webkit.org/show_bug.cgi?id=118675
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        Fixed memory leaks by matching ref calls with unrefs.
     9
     10        * tests/testatk.c:
     11        (testWebkitAtkCaretOffsets):
     12        (testWebkitAtkCaretOffsetsAndExtranousWhiteSpaces):
     13        (testWebkitAtkGetTextAtOffset):
     14        (testWebkitAtkGetTextAtOffsetNewlines):
     15        (testWebkitAtkGetTextAtOffsetTextarea):
     16        (testWebkitAtkGetTextAtOffsetTextInput):
     17        (testWebkitAtkGetTextInParagraphAndBodySimple):
     18        (testWebkitAtkGetTextInParagraphAndBodyModerate):
     19        (testWebkitAtkTextAttributes):
     20        (testWebkitAtkTextSelections):
     21        (testWebkitAtkListsOfItems):
     22
    1232013-08-29  Zan Dobersek  <zdobersek@igalia.com>
    224
  • trunk/Source/WebKit/gtk/tests/testatk.c

    r153947 r154953  
    375375    g_assert_cmpstr(text, ==, "1. A list item");
    376376    g_free (text);
     377    g_object_unref(listItem);
    377378
    378379    listItem = atk_object_ref_accessible_child(list, 1);
     
    381382    g_assert_cmpstr(text, ==, "2. Block span in a list item\nInline span in a list item");
    382383    g_free (text);
     384    g_object_unref(listItem);
    383385
    384386    listItem = atk_object_ref_accessible_child(list, 2);
     
    454456    offset = atk_text_get_caret_offset(ATK_TEXT(tableCell));
    455457    g_assert_cmpint(offset, ==, 2);
     458    g_object_unref(tableCell);
    456459
    457460    /* Even empty table cells should implement AtkText, but report an empty string */
     
    462465    g_assert_cmpstr(text, ==, "");
    463466    g_free(text);
     467    g_object_unref(tableCell);
    464468
    465469    tableCell = atk_object_ref_accessible_child(table, 2);
     
    469473    g_assert_cmpstr(text, ==, "Block span in a link in a table cell\nInline span in a link in a table cell");
    470474    g_free(text);
     475    g_object_unref(tableCell);
    471476
    472477    tableCell = atk_object_ref_accessible_child(table, 3);
     
    483488    g_assert_cmpstr(text, ==, "Block span in a link in a heading\nInline span in a link in a heading");
    484489    g_free(text);
     490    g_object_unref(header);
    485491
    486492    header = atk_object_ref_accessible_child(object, 6);
     
    549555    g_assert_cmpint(caretOffset, ==, characterCount);
    550556
     557    g_object_unref(object);
    551558    g_object_unref(webView);
    552559}
     
    806813    runGetTextTests(textObject);
    807814
     815    g_object_unref(object);
    808816    g_object_unref(webView);
    809817}
     
    828836    runGetTextTests(textObject);
    829837
     838    g_object_unref(object);
    830839    g_object_unref(webView);
    831840}
     
    842851    AtkObject* object = getWebAreaObject(webView);
    843852    g_assert(object);
    844     object = atk_object_ref_accessible_child(object, 0);
    845     g_assert(object);
    846     object = atk_object_ref_accessible_child(object, 0);
    847     g_assert(object);
    848 
    849     AtkText* textObject = ATK_TEXT(object);
     853    AtkObject* child = atk_object_ref_accessible_child(object, 0);
     854    g_assert(child);
     855    AtkObject* grandchild = atk_object_ref_accessible_child(child, 0);
     856    g_assert(grandchild);
     857
     858    AtkText* textObject = ATK_TEXT(grandchild);
    850859    g_assert(ATK_IS_TEXT(textObject));
    851860
    852861    runGetTextTests(textObject);
    853862
     863    g_object_unref(child);
     864    g_object_unref(grandchild);
    854865    g_object_unref(webView);
    855866}
     
    866877    AtkObject* object = getWebAreaObject(webView);
    867878    g_assert(object);
    868     object = atk_object_ref_accessible_child(object, 0);
    869     g_assert(object);
    870     object = atk_object_ref_accessible_child(object, 0);
    871     g_assert(object);
    872 
    873     AtkText* textObject = ATK_TEXT(object);
     879    AtkObject* child = atk_object_ref_accessible_child(object, 0);
     880    g_assert(child);
     881    AtkObject* grandchild = atk_object_ref_accessible_child(child, 0);
     882    g_assert(grandchild);
     883
     884    AtkText* textObject = ATK_TEXT(grandchild);
    874885    g_assert(ATK_IS_TEXT(textObject));
    875886
    876887    runGetTextTests(textObject);
    877888
     889    g_object_unref(child);
     890    g_object_unref(grandchild);
    878891    g_object_unref(webView);
    879892}
     
    11501163    char *text = atk_text_get_text(textObject1, 0, -1);
    11511164    g_assert_cmpstr(text, ==, "This is a test.");
     1165    g_free(text);
    11521166
    11531167    text = atk_text_get_text(textObject2, 0, 12);
    11541168    g_assert_cmpstr(text, ==, "Hello world.");
     1169    g_free(text);
    11551170
    11561171    g_object_unref(object1);
     
    11821197    char *text = atk_text_get_text(textObject1, 0, -1);
    11831198    g_assert_cmpstr(text, ==, "This is a test.");
     1199    g_free(text);
    11841200
    11851201    text = atk_text_get_text(textObject2, 0, 53);
    11861202    g_assert_cmpstr(text, ==, "Hello world.\nThis sentence is green.\nThis one is not.");
     1203    g_free(text);
    11871204
    11881205    g_object_unref(object1);
     
    13831400    atk_attribute_set_free(set4);
    13841401
     1402    g_object_unref(child);
    13851403    child = atk_object_ref_accessible_child(object, 1);
    13861404    g_assert(child && ATK_IS_TEXT(child));
     
    14031421    atk_attribute_set_free(set1);
    14041422    atk_attribute_set_free(set2);
     1423    g_object_unref(child);
    14051424
    14061425    child = atk_object_ref_accessible_child(object, 2);
     
    14281447    atk_attribute_set_free(set3);
    14291448    atk_attribute_set_free(set4);
     1449    g_object_unref(child);
    14301450
    14311451    child = atk_object_ref_accessible_child(object, 3);
     
    14471467    atk_attribute_set_free(set2);
    14481468    atk_attribute_set_free(set3);
     1469
     1470    g_object_unref(child);
    14491471}
    14501472
     
    16191641    g_object_unref(paragraph1);
    16201642    g_object_unref(paragraph2);
     1643    g_object_unref(link);
    16211644    g_object_unref(list);
    16221645    g_object_unref(listItem);
     
    19421965    g_assert_cmpint(atk_object_get_n_accessible_children(item3), ==, 1);
    19431966
    1944     g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item1), 0, -1), ==, "\342\200\242 text only");
    1945     g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item2), 0, -1), ==, "\342\200\242 link only");
    1946     g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item3), 0, -1), ==, "\342\200\242 text and a link");
     1967    char* text = atk_text_get_text(ATK_TEXT(item1), 0, -1);
     1968    g_assert_cmpstr(text, ==, "\342\200\242 text only");
     1969    g_free(text);
     1970    text = atk_text_get_text(ATK_TEXT(item2), 0, -1);
     1971    g_assert_cmpstr(text, ==, "\342\200\242 link only");
     1972    g_free(text);
     1973    text = atk_text_get_text(ATK_TEXT(item3), 0, -1);
     1974    g_assert_cmpstr(text, ==, "\342\200\242 text and a link");
     1975    g_free(text);
    19471976
    19481977    g_object_unref(item1);
     
    19641993    g_assert(ATK_IS_TEXT(item3));
    19651994
    1966     g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item1), 0, -1), ==, "1. text only");
    1967     g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item2), 0, -1), ==, "2. link only");
    1968     g_assert_cmpstr(atk_text_get_text(ATK_TEXT(item3), 0, -1), ==, "3. text and a link");
     1995    text = atk_text_get_text(ATK_TEXT(item1), 0, -1);
     1996    g_assert_cmpstr(text, ==, "1. text only");
     1997    g_free(text);
     1998    text = atk_text_get_text(ATK_TEXT(item2), 0, -1);
     1999    g_assert_cmpstr(text, ==, "2. link only");
     2000    g_free(text);
     2001    text = atk_text_get_text(ATK_TEXT(item3), 0, -1);
     2002    g_assert_cmpstr(text, ==, "3. text and a link");
     2003    g_free(text);
    19692004
    19702005    g_assert_cmpint(atk_object_get_n_accessible_children(item1), ==, 0);
Note: See TracChangeset for help on using the changeset viewer.