[gtk+] a11y: Check whether a widget is mapped before querying its parent



commit 3f2aacca526c6b4c1eda99b684f273c0a32449bc
Author: Mike Gorse <mgorse suse com>
Date:   Fri Aug 30 09:13:39 2013 -0500

    a11y: Check whether a widget is mapped before querying its parent
    
    Call gtk_widget_get_mapped() in a couple of places before looking at the
    widget's parent, since it might be set to a widget that has been
    finalized, causing an invalid read.

 gtk/a11y/gtkwidgetaccessible.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c
index 841ae14..3572e42 100644
--- a/gtk/a11y/gtkwidgetaccessible.c
+++ b/gtk/a11y/gtkwidgetaccessible.c
@@ -271,7 +271,7 @@ gtk_widget_accessible_ref_relation_set (AtkObject *obj)
       label = find_label (widget);
       if (label == NULL)
         {
-          if (GTK_IS_BUTTON (widget))
+          if (GTK_IS_BUTTON (widget) && gtk_widget_get_mapped (widget))
             /*
              * Handle the case where GnomeIconEntry is the mnemonic widget.
              * The GtkButton which is a grandchild of the GnomeIconEntry
@@ -781,6 +781,9 @@ gtk_widget_accessible_on_screen (GtkWidget *widget)
 
   gtk_widget_get_allocation (widget, &allocation);
 
+  if (!gtk_widget_get_mapped (widget))
+    return FALSE;
+
   viewport = gtk_widget_get_ancestor (widget, GTK_TYPE_VIEWPORT);
   if (viewport)
     {


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