[gtkhtml] Work around an accessibility crash.



commit 0e2bd39daa7cf116f022f1c5734403b29dc3fa93
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Apr 11 09:35:50 2011 -0400

    Work around an accessibility crash.
    
    For some reason, gtk_html_a11y_new() is being called during a GtkHTML
    dispose.  The HTMLEngine pointer was NULL, which caused a crash when the
    a11y logic tried to do html->engine->clue.  This strikes me as a libgail
    issue, but for now just work around it.

 a11y/object.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/a11y/object.c b/a11y/object.c
index b344270..f549bb3 100644
--- a/a11y/object.c
+++ b/a11y/object.c
@@ -380,8 +380,10 @@ gtk_html_a11y_delete_object_cb (GtkWidget * widget, gint pos, gint len)
 AtkObject*
 gtk_html_a11y_new (GtkWidget *widget)
 {
+	GtkHTML *html;
 	GObject *object;
-	AtkObject *accessible, *focus_object;
+	AtkObject *accessible;
+	AtkObject *focus_object = NULL;
 
 	g_return_val_if_fail (GTK_IS_HTML (widget), NULL);
 
@@ -404,12 +406,12 @@ gtk_html_a11y_new (GtkWidget *widget)
 			G_CALLBACK (gtk_html_a11y_delete_object_cb),
 			NULL);
 
-	if (GTK_HTML (widget)->engine->clue)
-		html_utils_get_accessible (GTK_HTML (widget)->engine->clue, accessible);
-
-	/* printf ("created new gtkhtml accessible object\n"); */
+	html = GTK_HTML (widget);
 
-	focus_object = gtk_html_a11y_get_focus_object (widget);
+	if (html->engine != NULL && html->engine->clue != NULL) {
+		html_utils_get_accessible (html->engine->clue, accessible);
+		focus_object = gtk_html_a11y_get_focus_object (widget);
+	}
 
 	if (focus_object && gtk_html_a11y_focus_object != focus_object) {
 		gtk_html_a11y_focus_object = focus_object;



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