[Evolution-hackers] Re: gtkhtml, evolution crash when compose a html message



Sorry, I attached a wrong patch, :P.
I'm attaching the right one.

Eric.

Eric Zhao wrote:

Hi,
The attachment is a patch for bug #62223.( http://bugs.ximian.com/show_bug.cgi?id=62223 ). Could you spend some time to give it a review? Thanks!

Regards,
Eric

------------------------------------------------------------------------

Index: a11y/e-table/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/Makefile.am,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile.am
--- a11y/e-table/Makefile.am	17 Dec 2003 02:35:20 -0000	1.7
+++ a11y/e-table/Makefile.am	17 Jul 2004 13:27:38 -0000
@@ -19,6 +19,7 @@ libgal_a11y_etable_la_SOURCES =			\
	gal-a11y-e-cell-toggle.c		\
	gal-a11y-e-cell-popup.c			\
	gal-a11y-e-cell-registry.c		\
+	gal-a11y-e-cell-vbox.c			\
	gal-a11y-e-table.c			\
	gal-a11y-e-table-item.c			\
	gal-a11y-e-table-item-factory.c		\
@@ -37,6 +38,7 @@ libgal_a11y_etableinclude_HEADERS =		\
	gal-a11y-e-cell-toggle.h		\
	gal-a11y-e-cell-popup.h			\
	gal-a11y-e-cell-registry.h		\
+	gal-a11y-e-cell-vbox.h			\
	gal-a11y-e-table.h			\
	gal-a11y-e-table-item.h			\
	gal-a11y-e-table-click-to-add-factory.h	\
Index: e-table/e-cell-vbox.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-vbox.c,v
retrieving revision 1.4
diff -u -p -r1.4 e-cell-vbox.c
--- e-table/e-cell-vbox.c	17 Nov 2002 00:02:53 -0000	1.4
+++ e-table/e-cell-vbox.c	17 Jul 2004 13:27:38 -0000
@@ -42,18 +42,13 @@
#include <gdk/gdkkeysyms.h>

#include "gal/util/e-util.h"
+#include "gal/a11y/e-table/gal-a11y-e-cell-registry.h"
+#include "gal/a11y/e-table/gal-a11y-e-cell-vbox.h"
#include "e-table-item.h"
#include "e-cell-vbox.h"

#define PARENT_TYPE e_cell_get_type ()

-typedef struct {
-	ECellView     cell_view;
-	int           subcell_view_count;
-	ECellView   **subcell_views;
-	int          *model_cols;
-} ECellVboxView;
-
static ECellClass *parent_class;

#define INDENT_AMOUNT 16
@@ -443,6 +438,8 @@ e_cell_vbox_class_init (GObjectClass *ob
#endif

	parent_class = g_type_class_ref (PARENT_TYPE);
+
+	gal_a11y_e_cell_registry_add_cell_type (NULL, E_CELL_VBOX_TYPE, gal_a11y_e_cell_vbox_new);
}

static void
Index: e-table/e-cell-vbox.h
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-vbox.h,v
retrieving revision 1.3
diff -u -p -r1.3 e-cell-vbox.h
--- e-table/e-cell-vbox.h	17 Nov 2002 00:02:53 -0000	1.3
+++ e-table/e-cell-vbox.h	17 Jul 2004 13:27:38 -0000
@@ -50,6 +50,13 @@ typedef struct {
} ECellVbox;

typedef struct {
+	ECellView     cell_view;
+	int           subcell_view_count;
+	ECellView   **subcell_views;
+	int          *model_cols;
+} ECellVboxView;
+
+typedef struct {
	ECellClass parent_class;
} ECellVboxClass;


Index: text.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/text.c,v
retrieving revision 1.9
diff -u -p -r1.9 text.c
--- text.c	4 Jun 2004 14:46:33 -0000	1.9
+++ text.c	1 Aug 2004 10:59:38 -0000
@@ -307,6 +307,8 @@ html_a11y_text_get_text (AtkText *text, 
 	HTMLText *to = HTML_TEXT (HTML_A11Y_HTML (text));
 	gchar *str;
 
+	g_return_val_if_fail (to, NULL);
+
 	/* printf ("%d - %d\n", start_offset, end_offset); */
 	if (end_offset == -1)
 		end_offset = to->text_len;
@@ -463,7 +465,7 @@ html_a11y_text_get_character_at_offset (
 {
 	HTMLText *to = HTML_TEXT (HTML_A11Y_HTML (text));
 
-	g_return_val_if_fail (offset <= to->text_len, 0);
+	g_return_val_if_fail (to && offset <= to->text_len, 0);
 
 	return html_text_get_char (to, offset);
 }
@@ -521,13 +523,19 @@ html_a11y_text_get_text_before_offset (A
 static gint
 html_a11y_text_get_character_count (AtkText *text)
 {
-	return HTML_TEXT (HTML_A11Y_HTML (text))->text_len;
+	HTMLText *to = HTML_TEXT (HTML_A11Y_HTML (text));
+
+	g_return_val_if_fail (to, 0);
+	return to->text_len;
 }
 
 static gint
 html_a11y_text_get_n_selections (AtkText *text)
 {
-	return HTML_A11Y_HTML (text)->selected ? 1 : 0;
+	HTMLObject *to = HTML_A11Y_HTML (text);
+
+	g_return_val_if_fail (to, 0);
+	return to->selected ? 1 : 0;
 }
 
 static gchar *
@@ -535,7 +543,7 @@ html_a11y_text_get_selection (AtkText *t
 {
 	HTMLText *to = HTML_TEXT (HTML_A11Y_HTML (text));
 
-	if (!HTML_OBJECT (to)->selected || selection_num > 0)
+	if (!to || !HTML_OBJECT (to)->selected || selection_num > 0)
 		return NULL;
 
 	*start_offset = to->select_start;
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/ChangeLog,v
retrieving revision 1.10
diff -u -p -r1.10 ChangeLog
--- ChangeLog	7 Jun 2004 18:07:43 -0000	1.10
+++ ChangeLog	1 Aug 2004 11:02:44 -0000
@@ -1,3 +1,11 @@
+2004-08-01  Eric Zhao  <eric zhao sun com>
+
+	* text.c: (html_a11y_text_get_text),
+	(html_a11y_text_get_character_at_offset),
+	(html_a11y_text_get_character_count),
+	(html_a11y_text_get_n_selections), (html_a11y_text_get_selection):
+	add missed check, fixes bug #62223.
+
 Sat Jun  5 10:32:30 2004  Owen Taylor  <otaylor redhat com>
 
 	* html.c (html_a11y_ref_state_set): Fix missing initialization.


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