diff libpurple/ft.c @ 28823:16dfa8df7dd1

Call purple_xfer_cancel_local instead of purple_xfer_request_denied when a file send is cancelled due to invalid files or the user cancelling the file selection dialog. I think this makes more sense, since there is no request to deny. It fixes a crash on exit with Bonjour where it attempts to cancel a non-existent PurpleXfer since it doesn't expect request-denied to be called for a send, and holds on to the pointer after it's destroyed. I think this may have affected some other prpls like the Telepathy ones, too.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 23 Dec 2009 06:23:24 +0000
parents df5808d7e669
children 07ec4a569da1 10eaca0bf01a
line wrap: on
line diff
--- a/libpurple/ft.c	Wed Dec 23 05:57:45 2009 +0000
+++ b/libpurple/ft.c	Wed Dec 23 06:23:24 2009 +0000
@@ -312,7 +312,7 @@
 		}
 		else {
 			purple_xfer_show_file_error(xfer, filename);
-			purple_xfer_request_denied(xfer);
+			purple_xfer_cancel_local(xfer);
 		}
 	}
 	else if ((type == PURPLE_XFER_SEND) && (st.st_size == 0)) {
@@ -320,7 +320,7 @@
 		purple_notify_error(NULL, NULL,
 						  _("Cannot send a file of 0 bytes."), NULL);
 
-		purple_xfer_request_denied(xfer);
+		purple_xfer_cancel_local(xfer);
 	}
 	else if ((type == PURPLE_XFER_SEND) && S_ISDIR(st.st_mode)) {
 		/*
@@ -329,7 +329,7 @@
 		purple_notify_error(NULL, NULL,
 						  _("Cannot send a directory."), NULL);
 
-		purple_xfer_request_denied(xfer);
+		purple_xfer_cancel_local(xfer);
 	}
 	else if ((type == PURPLE_XFER_RECEIVE) && S_ISDIR(st.st_mode)) {
 		char *msg, *utf8;
@@ -371,7 +371,10 @@
 	PurpleXfer *xfer = (PurpleXfer *)user_data;
 
 	purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL);
-	purple_xfer_request_denied(xfer);
+	if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND)
+		purple_xfer_cancel_local(xfer);
+	else
+		purple_xfer_request_denied(xfer);
 	purple_xfer_unref(xfer);
 }