[at-spi2-core] Fix for BGO#648059: get_application should return something w/ROLE_APPLICATION



commit f2d5fab0b2d7802723b9104f3abd57bb30dd2a66
Author: Mike Gorse <mgorse novell com>
Date:   Mon Apr 18 05:07:14 2011 -0500

    Fix for BGO#648059: get_application should return something w/ROLE_APPLICATION
    
    atspi_accessible_get_application will walk up the tree until it finds a child
    of the desktop, but this causes it to return the wrong accessible if an
    object's parent is set to NULL for whatever reason, so check for this and
    return the object's root accessible in that case.

 atspi/atspi-accessible.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 05d2e16..86f47d8 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -719,6 +719,16 @@ atspi_accessible_get_application (AtspiAccessible *obj, GError **error)
   for (;;)
   {
     parent = atspi_accessible_get_parent (obj, NULL);
+    if (!parent &&
+        atspi_accessible_get_role (obj, NULL) != ATSPI_ROLE_APPLICATION)
+    {
+      AtspiAccessible *root = g_object_ref (obj->parent.app->root);
+      if (root)
+      {
+        g_object_unref (obj);
+        return root;
+      }
+    }
     if (!parent || parent == obj ||
         atspi_accessible_get_role (parent, NULL) == ATSPI_ROLE_DESKTOP_FRAME)
     return obj;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]