[evolution-patches] gtkhtml #42034: fixes crash in search code when search starts at table object



http://bugzilla.ximian.com/show_bug.cgi?id=42034

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1789
diff -u -p -r1.1789 ChangeLog
--- ChangeLog	1 May 2003 20:53:24 -0000	1.1789
+++ ChangeLog	2 May 2003 09:52:04 -0000
@@ -1,3 +1,10 @@
+2003-05-02  Radek Doulik  <rodo ximian com>
+
+	* htmlsearch.h: make start_pos and end_pos signed
+
+	* htmlclueflow.c (search): handle containers in search, take care
+	about start_pos
+
 2003-05-01  Larry Ewing  <lewing ximian com>
 
 	* htmlengine.c (html_engine_thaw_idle_flush): actually remove the
Index: htmlclueflow.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlclueflow.c,v
retrieving revision 1.286
diff -u -p -r1.286 htmlclueflow.c
--- htmlclueflow.c	29 Apr 2003 20:16:04 -0000	1.286
+++ htmlclueflow.c	2 May 2003 09:52:05 -0000
@@ -2138,20 +2138,31 @@ search (HTMLObject *obj, HTMLSearch *inf
 		}
 	}
 	while (cur) {
+		gboolean found = FALSE;
+		gboolean is_text;
+
+		is_text = html_object_is_text (cur);
+
 		if (html_object_is_text (cur)) {
 			if (search_text (&cur, info))
 				return TRUE;
-		} else {
-			html_search_push (info, cur);
-			if (html_object_search (cur, info))
-				return TRUE;
-			html_search_pop (info);
-			cur = (info->forward) ? cur->next : cur->prev;
 		}
+
 		if (info->found) {
 			g_list_free (info->found);
 			info->found = NULL;
 			info->start_pos = 0;
+			found = TRUE;
+		}
+
+		if (!is_text) {
+			if (!found || (info->start_pos < 0 && info->forward) || (info->start_pos >= 0 && !info->forward)) {
+				html_search_push (info, cur);
+				if (html_object_search (cur, info))
+					return TRUE;
+				html_search_pop (info);
+			}
+			cur = (info->forward) ? cur->next : cur->prev;
 		}
 	}
 
Index: htmlsearch.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlsearch.h,v
retrieving revision 1.7
diff -u -p -r1.7 htmlsearch.h
--- htmlsearch.h	27 Nov 2000 12:38:53 -0000	1.7
+++ htmlsearch.h	2 May 2003 09:52:05 -0000
@@ -42,8 +42,8 @@ struct _HTMLSearch {
 	GList       *found;
 	HTMLObject *last;
 
-	guint start_pos;
-	guint stop_pos;
+	gint start_pos;
+	gint stop_pos;
 
 	regex_t *reb;        /* regex buffer */
 };


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