[Gtkhtml] Fix for #332807

"simon.zheng" <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <1141097492.1207.16.camel@fulltime>
Hi,

Bug #332807 - Copy contact to address book causes Evolution to crash.
http://bugzilla.gnome.org/show_bug.cgi?id=332807

Crash is caused by logging a critical message. When gtkhtml engine is
just initialized, clue is possibly NULL. To avoid logging a critical
message, check validity before invoking html_utils_get_accessible(). In
addition, initializing a11y object only when accessibility is enabled.

Sending a patch for review.

Regards,
-Simon

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
gtkhtml-332807-a11y-initilize.diff (text/x-patch, 2 KB)
Index: a11y/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/ChangeLog,v
retrieving revision 1.27
diff -u -p -r1.27 ChangeLog
--- a11y/ChangeLog	17 Aug 2005 01:53:32 -0000	1.27
+++ a11y/ChangeLog	28 Feb 2006 03:19:23 -0000
@@ -1,3 +1,13 @@
+2006-02-28  Simon Zheng  <[email protected]>
+
+	* factory.c: (gtk_html_accessibility_init): Initilize only when accessibility 
+	is enabled.
+	* object.c: (gtk_html_a11y_new): When engine is just initilized, clue is possibly
+	NULL. To avoid logging a critical message, check validity before invoking 
+	html_utils_get_accessible(). 
+
+	Fixes #332807
+
 2005-08-10  Mengjie Yu  <[email protected]>
 
 	* text.c: (html_a11y_text_get_run_attributes):
Index: a11y/factory.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/factory.c,v
retrieving revision 1.2
diff -u -p -r1.2 factory.c
--- a11y/factory.c	1 Nov 2002 15:34:27 -0000	1.2
+++ a11y/factory.c	28 Feb 2006 03:19:23 -0000
@@ -57,7 +57,8 @@ gtk_html_accessibility_init (void)
 	if (accessibility_initialized)
 		return;
 
-	atk_registry_set_factory_type (atk_get_default_registry (), GTK_TYPE_HTML, gtk_html_a11y_factory_get_type ());
+	if (atk_get_root())
+		atk_registry_set_factory_type (atk_get_default_registry (), GTK_TYPE_HTML, gtk_html_a11y_factory_get_type ());
 
 	accessibility_initialized = TRUE;
 }
Index: a11y/object.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/object.c,v
retrieving revision 1.13
diff -u -p -r1.13 object.c
--- a11y/object.c	6 Jul 2005 10:35:00 -0000	1.13
+++ a11y/object.c	28 Feb 2006 03:19:23 -0000
@@ -419,7 +419,8 @@ gtk_html_a11y_new (GtkWidget *widget)
 			G_CALLBACK(gtk_html_a11y_delete_object_cb),
 			NULL);
 
-	html_utils_get_accessible(GTK_HTML(widget)->engine->clue, accessible);
+	if (GTK_HTML(widget)->engine->clue)
+		html_utils_get_accessible(GTK_HTML(widget)->engine->clue, accessible);
 
 	/* printf ("created new gtkhtml accessible object\n"); */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.