bug 680929 - don't return empty relations to atk r=davidb
authorTrevor Saunders <trev.saunders@gmail.com>
Mon, 22 Aug 2011 11:15:50 -0700
changeset 75667 e11c851aab48b70d958a38eac5a80fb43d29137b
parent 75666 14ebdc83383736e491333f88e5a3e468cefa7f6c
child 75668 bf17068db7de8833b2cff42886f505f683ce1ce1
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersdavidb
bugs680929
milestone9.0a1
bug 680929 - don't return empty relations to atk r=davidb
accessible/src/atk/nsAccessibleWrap.cpp
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -971,19 +971,21 @@ refRelationSetCB(AtkObject *aAtkObj)
       atk_relation_set_remove(relation_set, atkRelation);
 
     Relation rel(accWrap->RelationByType(relationTypes[i]));
     nsTArray<AtkObject*> targets;
     nsAccessible* tempAcc = nsnull;
     while ((tempAcc = rel.Next()))
       targets.AppendElement(nsAccessibleWrap::GetAtkObject(tempAcc));
 
-    atkRelation = atk_relation_new(targets.Elements(), targets.Length(), atkType);
-    atk_relation_set_add(relation_set, atkRelation);
-    g_object_unref(atkRelation);
+    if (targets.Length()) {
+      atkRelation = atk_relation_new(targets.Elements(), targets.Length(), atkType);
+      atk_relation_set_add(relation_set, atkRelation);
+      g_object_unref(atkRelation);
+    }
   }
 
   return relation_set;
 }
 
 // Check if aAtkObj is a valid MaiAtkObject, and return the nsAccessibleWrap
 // for it.
 nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)