Call purple_xfer_cancel_local instead of purple_xfer_request_denied when

Wed, 23 Dec 2009 06:23:24 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Wed, 23 Dec 2009 06:23:24 +0000
changeset 29159
742ae16831fa
parent 29158
5c4323a2f2b0
child 29160
06bf248756a1

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.

ChangeLog.API file | annotate | diff | comparison | revisions
libpurple/ft.c file | annotate | diff | comparison | revisions
--- a/ChangeLog.API	Wed Dec 23 05:57:45 2009 +0000
+++ b/ChangeLog.API	Wed Dec 23 06:23:24 2009 +0000
@@ -1,6 +1,12 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
 version 2.6.5 (??/??/20??):
+	libpurple:
+		Changed:
+		* purple_xfer_cancel_local is now called instead of
+		  purple_xfer_request_denied if an error is found when selecting
+		  a file to send. Request denied is still used when a receive
+		  request is not allowed.
 
 version 2.6.4 (11/29/2009):
 	No changes
--- 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);
 }
 

mercurial