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



commit b4e4e211a6787b7ffebcad6ed192cf282def1496
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 6f4acaa..6bfc654 100644
--- a/gtk/a11y/gtkwidgetaccessible.c
+++ b/gtk/a11y/gtkwidgetaccessible.c
@@ -270,7 +270,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
@@ -784,6 +784,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]