brasero r1603 - in trunk: . src



Author: philippr
Date: Wed Dec  3 19:11:01 2008
New Revision: 1603
URL: http://svn.gnome.org/viewvc/brasero?rev=1603&view=rev

Log:
	Fix #559161 â Trying to burn to previously used CDRW does not offer to erase and claims to burn endlessly
	brasero-volume.c didn\'t get out of the loop when the unmount operation
	failed which meant brasero got stuck. This is fixed and to make sure
	we won\'t loop indefinitely I added a timeout of 20 sec for all operations.

	* src/burn-volume-obj.c (brasero_volume_operation_end),
	(brasero_volume_operation_timeout),
	(brasero_volume_wait_for_operation_end),
	(brasero_volume_umount_finish), (brasero_volume_finalize):
	* src/burn.c (brasero_burn_progress_changed):

Modified:
   trunk/ChangeLog
   trunk/src/burn-volume-obj.c
   trunk/src/burn.c

Modified: trunk/src/burn-volume-obj.c
==============================================================================
--- trunk/src/burn-volume-obj.c	(original)
+++ trunk/src/burn-volume-obj.c	Wed Dec  3 19:11:01 2008
@@ -38,6 +38,7 @@
 {
 	GCancellable *cancel;
 
+	guint timeout_id;
 	GMainLoop *loop;
 	gboolean result;
 	GError *error;
@@ -225,6 +226,36 @@
 	return local_path;
 }
 
+static void
+brasero_volume_operation_end (BraseroVolume *self)
+{
+	BraseroVolumePrivate *priv;
+
+	priv = BRASERO_VOLUME_PRIVATE (self);
+	if (!priv->loop)
+		return;
+
+	if (!g_main_loop_is_running (priv->loop))
+		return;
+
+	g_main_loop_quit (priv->loop);	
+}
+
+static gboolean
+brasero_volume_operation_timeout (gpointer data)
+{
+	BraseroVolume *self = BRASERO_VOLUME (data);
+	BraseroVolumePrivate *priv;
+
+	priv = BRASERO_VOLUME_PRIVATE (self);
+	brasero_volume_operation_end (self);
+
+	BRASERO_BURN_LOG ("Volume/Disc operation timed out");
+	priv->timeout_id = 0;
+	priv->result = FALSE;
+	return FALSE;
+}
+
 static gboolean
 brasero_volume_wait_for_operation_end (BraseroVolume *self,
 				       GError **error)
@@ -233,13 +264,22 @@
 
 	priv = BRASERO_VOLUME_PRIVATE (self);
 
-	/* FIXME! that's where we should put a timeout (30 sec ?) */
+	/* put a timeout (30 sec) */
+	priv->timeout_id = g_timeout_add_seconds (20,
+						  brasero_volume_operation_timeout,
+						  self);
+
 	priv->loop = g_main_loop_new (NULL, FALSE);
 	g_main_loop_run (priv->loop);
 
 	g_main_loop_unref (priv->loop);
 	priv->loop = NULL;
 
+	if (priv->timeout_id) {
+		g_source_remove (priv->timeout_id);
+		priv->timeout_id = 0;
+	}
+
 	if (priv->error) {
 		if (error)
 			g_propagate_error (error, priv->error);
@@ -254,21 +294,6 @@
 }
 
 static void
-brasero_volume_operation_end (BraseroVolume *self)
-{
-	BraseroVolumePrivate *priv;
-
-	priv = BRASERO_VOLUME_PRIVATE (self);
-	if (!priv->loop)
-		return;
-
-	if (!g_main_loop_is_running (priv->loop))
-		return;
-
-	g_main_loop_quit (priv->loop);	
-}
-
-static void
 brasero_volume_umounted_cb (GVolumeMonitor *monitor,
 			    GMount *mount,
 			    BraseroVolume *self)
@@ -334,6 +359,8 @@
 		 * we didn't get out of the loop. */
 		brasero_volume_operation_end (self);
 	}
+	else if (!priv->result)
+		brasero_volume_operation_end (self);
 }
 
 gboolean
@@ -755,6 +782,11 @@
 		priv->cancel = NULL;
 	}
 
+	if (priv->timeout_id) {
+		g_source_remove (priv->timeout_id);
+		priv->timeout_id = 0;
+	}
+
 	if (priv->loop && g_main_loop_is_running (priv->loop))
 		g_main_loop_quit (priv->loop);
 

Modified: trunk/src/burn.c
==============================================================================
--- trunk/src/burn.c	(original)
+++ trunk/src/burn.c	Wed Dec  3 19:11:01 2008
@@ -1177,7 +1177,6 @@
 	/* get the task current progress */
 	if (brasero_task_ctx_get_progress (task, &task_progress) == BRASERO_BURN_OK) {
 		brasero_task_ctx_get_remaining_time (task, &time_remaining);
-		g_print ("%d %d\n", priv->tasks_done, priv->task_nb);
 		overall_progress = (task_progress + (gdouble) priv->tasks_done) /
 				   (gdouble) priv->task_nb;
 	}



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