[gvfs/gnome-3-12] ftp: Only free connection if non-NULL



commit 7b1d51379bd1b28de9426aebc0832bc959760cf6
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Thu Jul 31 18:54:46 2014 +0100

    ftp: Only free connection if non-NULL
    
    Only attempt to free the connection if it is non-NULL, to prevent
    warnings like the following:
    ** (process:30854): CRITICAL **: g_vfs_ftp_connection_free: assertion 'conn != NULL' failed
    
    The connection can be NULL if g_vfs_ftp_connection_new is cancelled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=591054

 daemon/gvfsftptask.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsftptask.c b/daemon/gvfsftptask.c
index 10aeab4..068edd8 100644
--- a/daemon/gvfsftptask.c
+++ b/daemon/gvfsftptask.c
@@ -233,10 +233,11 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task)
               g_vfs_ftp_task_setup_connection (task);
               if (G_LIKELY (!g_vfs_ftp_task_is_in_error (task)))
                 break;
+
+              g_vfs_ftp_connection_free (task->conn);
+              task->conn = NULL;
             }
 
-          g_vfs_ftp_connection_free (task->conn);
-          task->conn = NULL;
           g_mutex_lock (&ftp->mutex);
           ftp->connections--;
           /* If this value is still equal to our thread it means there were no races 


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