Author: benny Date: 2007-01-12 18:51:05 +0000 (Fri, 12 Jan 2007) New Revision: 24375
Modified: thunar/trunk/ChangeLog thunar/trunk/thunar-vfs/thunar-vfs-io-local-xfer.c thunar/trunk/thunar-vfs/thunar-vfs-transfer-job.c Log: 2007-01-12 Benedikt Meurer <[EMAIL PROTECTED]> * thunar-vfs/thunar-vfs-io-local-xfer.c(tvilx_copy_regular): Drop unused variable. * thunar-vfs/thunar-vfs-transfer-job.c: Properly report errors if copying a file fails for some reason. Also fix a memory leak that wasn't detected previously. Modified: thunar/trunk/ChangeLog =================================================================== --- thunar/trunk/ChangeLog 2007-01-12 18:13:37 UTC (rev 24374) +++ thunar/trunk/ChangeLog 2007-01-12 18:51:05 UTC (rev 24375) @@ -1,5 +1,13 @@ 2007-01-12 Benedikt Meurer <[EMAIL PROTECTED]> + * thunar-vfs/thunar-vfs-io-local-xfer.c(tvilx_copy_regular): Drop + unused variable. + * thunar-vfs/thunar-vfs-transfer-job.c: Properly report errors if + copying a file fails for some reason. Also fix a memory leak that + wasn't detected previously. + +2007-01-12 Benedikt Meurer <[EMAIL PROTECTED]> + * thunar/thunar-window.c: Finally fix crash on platforms where sizeof(GType) != sizeof(gint). Bug #2726. Modified: thunar/trunk/thunar-vfs/thunar-vfs-io-local-xfer.c =================================================================== --- thunar/trunk/thunar-vfs/thunar-vfs-io-local-xfer.c 2007-01-12 18:13:37 UTC (rev 24374) +++ thunar/trunk/thunar-vfs/thunar-vfs-io-local-xfer.c 2007-01-12 18:51:05 UTC (rev 24375) @@ -1,6 +1,6 @@ /* $Id$ */ /*- - * Copyright (c) 2005-2006 Benedikt Meurer <[EMAIL PROTECTED]> + * Copyright (c) 2005-2007 Benedikt Meurer <[EMAIL PROTECTED]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -154,7 +154,6 @@ gchar *display_name; gchar *buffer; gsize bufsize; - gsize completed; gint source_fd; gint target_fd; gint n, m, l; @@ -258,7 +257,7 @@ buffer = g_new (gchar, bufsize); /* copy the data from the source file to the target file */ - for (completed = 0; completed < source_statb->st_size; ) + for (;;) { /* read a chunk from the source file */ n = read (source_fd, buffer, bufsize); Modified: thunar/trunk/thunar-vfs/thunar-vfs-transfer-job.c =================================================================== --- thunar/trunk/thunar-vfs/thunar-vfs-transfer-job.c 2007-01-12 18:13:37 UTC (rev 24374) +++ thunar/trunk/thunar-vfs/thunar-vfs-transfer-job.c 2007-01-12 18:51:05 UTC (rev 24375) @@ -1,6 +1,6 @@ /* $Id$ */ /*- - * Copyright (c) 2005-2006 Benedikt Meurer <[EMAIL PROTECTED]> + * Copyright (c) 2005-2007 Benedikt Meurer <[EMAIL PROTECTED]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -54,7 +54,8 @@ ThunarVfsTransferNode *transfer_node, ThunarVfsPath *target_path, ThunarVfsPath *target_parent_path, - GList **target_path_list_return); + GList **target_path_list_return, + GError **error); static void thunar_vfs_transfer_node_free (ThunarVfsTransferNode *transfer_node); static gboolean thunar_vfs_transfer_node_collect (ThunarVfsTransferNode *transfer_node, ThunarVfsFileSize *total_size_return, @@ -215,7 +216,7 @@ break; /* copy the file for this node */ - thunar_vfs_transfer_job_node_copy (transfer_job, sp->data, tp->data, NULL, &new_files_list); + thunar_vfs_transfer_job_node_copy (transfer_job, sp->data, tp->data, NULL, &new_files_list, &err); } } @@ -331,7 +332,8 @@ ThunarVfsTransferNode *transfer_node, ThunarVfsPath *target_path, ThunarVfsPath *target_parent_path, - GList **target_path_list_return) + GList **target_path_list_return, + GError **error) { ThunarVfsPath *target_path_return; gchar *display_name; @@ -340,6 +342,7 @@ _thunar_vfs_return_if_fail ((target_path == NULL && target_parent_path != NULL) || (target_path != NULL && target_parent_path == NULL)); _thunar_vfs_return_if_fail (target_path == NULL || transfer_node->next == NULL); _thunar_vfs_return_if_fail (THUNAR_VFS_IS_TRANSFER_JOB (transfer_job)); + _thunar_vfs_return_if_fail (error == NULL || *error == NULL); _thunar_vfs_return_if_fail (transfer_node != NULL); /* The caller can either provide a target_path or a target_parent_path, but not both. The toplevel @@ -371,13 +374,22 @@ if (transfer_node->children != NULL) { /* copy all children for this node */ - thunar_vfs_transfer_job_node_copy (transfer_job, transfer_node->children, NULL, target_path_return, NULL); + thunar_vfs_transfer_job_node_copy (transfer_job, transfer_node->children, NULL, target_path_return, NULL, &err); /* free the resources allocated to the children */ thunar_vfs_transfer_node_free (transfer_node->children); transfer_node->children = NULL; } + /* check if the child copy failed */ + if (G_UNLIKELY (err != NULL)) + { + /* outa here, freeing the target paths */ + thunar_vfs_path_unref (target_path_return); + thunar_vfs_path_unref (target_path); + break; + } + /* add the real target path to the return list */ if (G_LIKELY (target_path_list_return != NULL)) *target_path_list_return = g_list_prepend (*target_path_list_return, target_path_return); @@ -409,6 +421,13 @@ thunar_vfs_path_unref (target_path); target_path = NULL; } + + /* check if we failed */ + if (G_UNLIKELY (err != NULL)) + { + /* propagate the error */ + g_propagate_error (error, err); + } } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits