Request for freeze break approval to fix crash with minicom in vte



Hi.

This patch is a fix for crashes when resizing the terminal if you have
minicom running in it. The patch is from Søren Sandmann and the problem
was introduced by his patch to improve performance in vte.

I also experimented with VTE_COALESCE_TIMEOUT and VTE_DISPLAY_TIMEOUT to
find values that made g-t similar to xterm in terms of scrolling and
outputting text when cat'ing a large amount of text, but still keeping
us ahead in terms of speed when using the same font and -u8

I tested with 'xterm -u8 -fa Monospace -fs 10' and gnome-terminal was
still 5 seconds faster when cat'ing 3MB of text.

Lastly it removes some stale debugging code that is trying to use
previously removed members of a struct, and thus breaking build if
VTE_DEBUG is enabled.

Cheers
Kjartan

? vte-fixes.patch
Index: vte.c
===================================================================
RCS file: /cvs/gnome/vte/src/vte.c,v
retrieving revision 1.416
diff -u -p -r1.416 vte.c
--- vte.c	2 Mar 2005 22:52:18 -0000	1.416
+++ vte.c	2 Mar 2005 22:53:38 -0000
@@ -112,8 +112,8 @@ typedef gunichar wint_t;
 #define VTE_REGEXEC_FLAGS		0
 #define VTE_INPUT_CHUNK_SIZE		0x1000
 #define VTE_INVALID_BYTE		'?'
-#define VTE_COALESCE_TIMEOUT		10
-#define VTE_DISPLAY_TIMEOUT		15
+#define VTE_COALESCE_TIMEOUT		2
+#define VTE_DISPLAY_TIMEOUT		2
 
 /* The structure we use to hold characters we're supposed to display -- this
  * includes any supported visible attributes. */
@@ -7874,17 +7874,6 @@ vte_terminal_process_incoming(VteTermina
 			(long) _vte_buffer_length(terminal->pvt->incoming));
 	}
 #endif
-
-#ifdef VTE_DEBUG
-	if (_vte_debug_on(VTE_DEBUG_IO)) {
-		if (terminal->pvt->processing) {
-			fprintf(stderr, "Leaving processing handler on.\n");
-		} else {
-			fprintf(stderr, "Turning processing handler off.\n");
-		}
-	}
-#endif
-
 	return again;
 }
 
@@ -15970,26 +15959,29 @@ vte_terminal_is_processing (VteTerminal 
  * It makes sure output is never delayed by more than DISPLAY_TIMEOUT
  */
 static gboolean
+need_processing (VteTerminal *terminal)
+{
+	return _vte_buffer_length(terminal->pvt->incoming) > 0 ||
+		(terminal->pvt->pending->len > 0);
+}
+	
+static gboolean
 display_timeout (gpointer data)
 {
 	gboolean cont;
 	VteTerminal *terminal = data;
 
-	cont = vte_terminal_process_incoming (terminal);
-
-	if (!cont) {
-		remove_coalesce_timeout (terminal);
-		
-		terminal->pvt->display_timeout = VTE_INVALID_SOURCE;
-
-		return FALSE;
-	}
-	else {
+	if (need_processing (terminal) && 
+	    vte_terminal_process_incoming(terminal)) {
 		remove_coalesce_timeout (terminal);
 		add_coalesce_timeout (terminal);
+		return TRUE;
 	}
 
-	return TRUE;
+	remove_coalesce_timeout (terminal);
+	terminal->pvt->display_timeout = VTE_INVALID_SOURCE;
+	
+	return FALSE;
 }
 
 /* This function is called whenever data haven't arrived for
@@ -16001,20 +15993,15 @@ coalesce_timeout (gpointer data)
 	gboolean cont;
 	VteTerminal *terminal = data;
 
-	cont = vte_terminal_process_incoming (terminal);
-
-	if (!cont) {
-		remove_display_timeout (terminal);
-
-		terminal->pvt->coalesce_timeout = VTE_INVALID_SOURCE;
-
-		return FALSE;
-	}
-	else {
-		/* reset display timeout since we just displayed */
+	if (need_processing (terminal) &&
+	    vte_terminal_process_incoming(terminal)) {
 		remove_display_timeout (terminal);
 		add_display_timeout (terminal);
+		return TRUE;
 	}
 
-	return TRUE;
+	remove_display_timeout (terminal);
+	terminal->pvt->coalesce_timeout = VTE_INVALID_SOURCE;
+
+	return FALSE;
  }


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