Changeset 152397 in webkit
- Timestamp:
- Jul 4, 2013 5:10:45 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152396 r152397 1 2013-07-04 Brian Holt <brian.holt@samsung.com> 2 3 [ATK] Leak: AtkAttributeSet* should be freed 4 https://bugs.webkit.org/show_bug.cgi?id=118307 5 6 Reviewed by Christophe Dumez. 7 8 Use AtkAttributeSet* instead of GSList*. 9 10 * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: 11 (webkitAccessibleGetObjectLocale): 12 1 13 2013-07-04 Mario Sanchez Prada <mario.prada@samsung.com> 2 14 -
trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
r151831 r152397 812 812 813 813 AtkAttributeSet* textAttributes = atk_text_get_default_attributes(ATK_TEXT(object)); 814 for ( GSList* attributes = textAttributes; attributes; attributes = attributes->next) {814 for (AtkAttributeSet* attributes = textAttributes; attributes; attributes = attributes->next) { 815 815 AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data); 816 816 if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE))) { … … 819 819 } 820 820 } 821 822 821 atk_attribute_set_free(textAttributes); 823 822 -
trunk/Tools/ChangeLog
r152373 r152397 1 2013-07-04 Brian Holt <brian.holt@samsung.com> 2 3 [ATK] Leak: AtkAttributeSet* should be freed 4 https://bugs.webkit.org/show_bug.cgi?id=118307 5 6 Reviewed by Christophe Dumez. 7 8 Fixed memory leaks for AtkAttributeSet by calling 9 atk_attribute_set_free(). 10 11 * DumpRenderTree/atk/AccessibilityControllerAtk.cpp: 12 (AccessibilityController::childElementById): 13 * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp: 14 (getAtkAttributeSetAsString): 15 (AccessibilityUIElement::allAttributes): 16 (AccessibilityUIElement::stringAttributeValue): 17 * WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp: 18 (WTR::childElementById): 19 * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: 20 (WTR::getAtkAttributeSetAsString): 21 (WTR::AccessibilityUIElement::allAttributes): 22 (WTR::AccessibilityUIElement::stringAttributeValue): 23 1 24 2013-07-03 David Farler <dfarler@apple.com> 2 25 -
trunk/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp
r145014 r152397 94 94 return 0; 95 95 96 AtkAttributeSet* attributeSet = atk_object_get_attributes(parent); 97 for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) { 96 bool parentFound = false; 97 AtkAttributeSet* attributeSet(atk_object_get_attributes(parent)); 98 for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { 98 99 AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); 99 100 if (!strcmp(attribute->name, "html-id")) { 100 101 if (!strcmp(attribute->value, id)) 101 return parent;102 parentFound = true; 102 103 break; 103 104 } 104 105 } 106 atk_attribute_set_free(attributeSet); 107 108 if (parentFound) 109 return parent; 105 110 106 111 int childCount = atk_object_get_n_accessible_children(parent); -
trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp
r152371 r152397 293 293 } 294 294 295 gchar* attributeSetToString(AtkAttributeSet* attributeSet)295 static char* getAtkAttributeSetAsString(AtkObject* accessible) 296 296 { 297 297 GString* str = g_string_new(0); 298 for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) { 298 299 AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible); 300 for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { 299 301 AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); 300 302 GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL)); … … 303 305 g_string_append(str, ", "); 304 306 } 307 atk_attribute_set_free(attributeSet); 305 308 306 309 return g_string_free(str, FALSE); … … 309 312 JSStringRef AccessibilityUIElement::allAttributes() 310 313 { 311 if (!m_element) 312 return JSStringCreateWithCharacters(0, 0); 313 314 ASSERT(ATK_IS_OBJECT(m_element)); 315 GOwnPtr<gchar> attributeData(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element)))); 314 if (!m_element || !ATK_IS_OBJECT(m_element)) 315 return JSStringCreateWithCharacters(0, 0); 316 317 GOwnPtr<char> attributeData(getAtkAttributeSetAsString(ATK_OBJECT(m_element))); 316 318 return JSStringCreateWithUTF8CString(attributeData.get()); 317 319 } … … 803 805 return JSStringCreateWithCharacters(0, 0); 804 806 805 for (GSList* atkAttributes = atk_object_get_attributes(ATK_OBJECT(m_element)); atkAttributes; atkAttributes = atkAttributes->next) { 806 AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(atkAttributes->data); 807 if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data())) 808 return JSStringCreateWithUTF8CString(atkAttribute->value); 807 const char* attributeValue = 0; 808 AtkAttributeSet* attributeSet = atk_object_get_attributes(ATK_OBJECT(m_element)); 809 for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { 810 AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data); 811 if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data())) { 812 attributeValue = atkAttribute->value; 813 break; 814 } 809 815 } 810 811 return JSStringCreateWithCharacters(0, 0); 816 JSStringRef jsString = attributeValue 817 ? JSStringCreateWithUTF8CString(attributeValue) 818 : JSStringCreateWithCharacters(0, 0); 819 atk_attribute_set_free(attributeSet); 820 821 return jsString; 812 822 } 813 823 -
trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp
r150431 r152397 156 156 return 0; 157 157 158 bool parentFound = false; 158 159 AtkAttributeSet* attributeSet = atk_object_get_attributes(parent); 159 for ( GSList* attributes = attributeSet; attributes; attributes = attributes->next) {160 for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { 160 161 AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); 161 162 if (!strcmp(attribute->name, "html-id")) { 162 163 if (!strcmp(attribute->value, id)) 163 return parent;164 parentFound = true; 164 165 break; 165 166 } 166 167 } 168 atk_attribute_set_free(attributeSet); 169 170 if (parentFound) 171 return parent; 167 172 168 173 int childCount = atk_object_get_n_accessible_children(parent); -
trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
r152371 r152397 54 54 } 55 55 56 static void attributesClear(AtkAttributeSet* attributesSet) 57 { 58 for (GSList* attributes = attributesSet; attributes; attributes = attributes->next) { 59 AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data); 60 g_free(atkAttribute->name); 61 g_free(atkAttribute->value); 62 g_free(atkAttribute); 63 } 64 } 65 66 static gchar* attributeSetToString(AtkAttributeSet* attributeSet) 67 { 68 GOwnPtr<GSList> atkAttributes(attributeSet); 56 static char* getAtkAttributeSetAsString(AtkObject* accessible) 57 { 69 58 GString* str = g_string_new(0); 70 for (GSList* attributes = atkAttributes.get(); attributes; attributes = attributes->next) { 59 60 AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible); 61 for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { 71 62 AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data); 72 63 GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL)); … … 75 66 g_string_append(str, ", "); 76 67 } 77 78 attributesClear(atkAttributes.get()); 68 atk_attribute_set_free(attributeSet); 79 69 80 70 return g_string_free(str, FALSE); … … 471 461 return JSStringCreateWithCharacters(0, 0); 472 462 473 GOwnPtr< gchar> attributeData(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element.get()))));463 GOwnPtr<char> attributeData(getAtkAttributeSetAsString(ATK_OBJECT(m_element.get()))); 474 464 return JSStringCreateWithUTF8CString(attributeData.get()); 475 465 } … … 484 474 return JSStringCreateWithCharacters(0, 0); 485 475 486 GOwnPtr<gchar> attributeValue;487 GOwnPtr<GSList> objectAttributes(atk_object_get_attributes(ATK_OBJECT(m_element.get())));488 for ( GSList* attributes = objectAttributes.get(); attributes; attributes = attributes->next) {476 const char* attributeValue = 0; 477 AtkAttributeSet* attributeSet = atk_object_get_attributes(ATK_OBJECT(m_element.get())); 478 for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) { 489 479 AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data); 490 480 if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data())) { 491 attributeValue .set(g_strdup(atkAttribute->value));481 attributeValue = atkAttribute->value; 492 482 break; 493 483 } 494 484 } 495 496 attributesClear(objectAttributes.get()); 497 498 return JSStringCreateWithUTF8CString(attributeValue.get()); 485 JSStringRef jsString = attributeValue 486 ? JSStringCreateWithUTF8CString(attributeValue) 487 : JSStringCreateWithCharacters(0, 0); 488 atk_attribute_set_free(attributeSet); 489 490 return jsString; 499 491 } 500 492
Note: See TracChangeset
for help on using the changeset viewer.