[PATCH] Progress Crash (#148791)



In time_remaining_callback() transfer_rate can get 0, if the transfer
stalls on a slow connection or if the user was asked about overwriting
an existing file. Nautilus then bombs over a division by zero when
calculating time_remaining.
The way it is handled now, the time spend in gui callbacks (like the
overwrite confirmation) counts towards the transfer time, because
gnome_vfs has no progress field for "effective_transfer_time". So you
have to use first_transfer_time, which really isn't what you are
interested in most of the time.
With this patch the progress dialog now shows nothing in place of the
remaining time in this case, which is unfortunately the only sane thing
we can do now until the progress calculation in gnome_vfs is enhanced.
When it is, we could put "(Stalled)" or something in the progress dialog
when transfer_rate approaches zero.

Please note that there's another progress related patch at #148690
pending review.

Martin

Index: libnautilus-private/nautilus-file-operations-progress.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-operations-progress.c,v
retrieving revision 1.42
diff -u -p -w -r1.42 nautilus-file-operations-progress.c
--- libnautilus-private/nautilus-file-operations-progress.c	14 Jun 2004 19:47:15 -0000	1.42
+++ libnautilus-private/nautilus-file-operations-progress.c	7 Aug 2004 16:11:57 -0000
@@ -388,6 +388,13 @@ time_remaining_callback (gpointer callba
 	
 	transfer_rate = progress->details->bytes_copied / elapsed_time;
 
+	if (transfer_rate == 0) {
+		progress->details->time_remaining_timeout_id =
+			g_timeout_add (TIME_REMAINING_TIMEOUT, time_remaining_callback, progress);
+
+		return FALSE;
+	}
+
 	time_remaining = (progress->details->bytes_total -
 			  progress->details->bytes_copied) / transfer_rate;
 


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