changeset 8282:ab35a0bec13a

[gaim-migrate @ 9006] " This works around the crash on trying to send a file that's too big, by giving an error. It also makes Gaim not crash on canceling the send right there. It doesn't fix the crash on the server doing whatever it did to make us crash. Someone should send me a backtrace of trying to send say a 2meg file without this patch." --Tim Ringenbach committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 17 Feb 2004 18:45:25 +0000
parents 98d8faecf5f1
children 35f69749b226
files src/gtkft.c src/protocols/yahoo/yahoo_filexfer.c
diffstat 2 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkft.c	Tue Feb 17 15:58:20 2004 +0000
+++ b/src/gtkft.c	Tue Feb 17 18:45:25 2004 +0000
@@ -868,6 +868,8 @@
 	if (data == NULL)
 		return;
 
+	if (!data->in_list)
+		return;
 
 	if ((gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) && (dialog->auto_clear)) {
 		gaim_gtkxfer_dialog_remove_xfer(dialog, xfer);
@@ -1011,6 +1013,7 @@
 	g_free(data->name);
 	data->name = NULL;
 
+	gaim_xfer_unref(xfer);
 	return 0;
 }
 
@@ -1042,8 +1045,10 @@
 
 	name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data->filesel));
 
-	if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(data->filesel)))
+	if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(data->filesel))) {
+		gaim_xfer_unref(xfer);
 		return;
+	}
 
 	if (stat(name, &st) != 0) {
 		/* File not found. */
@@ -1072,6 +1077,7 @@
 		}
 		else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) {
 			data->name = g_strdup(name);
+			gaim_xfer_ref(xfer);
 
 			gaim_request_yes_no(NULL, NULL,
 								_("That file already exists."),
@@ -1087,6 +1093,7 @@
 
 	gtk_widget_destroy(data->filesel);
 	data->filesel = NULL;
+	gaim_xfer_unref(xfer);
 }
 
 static int
@@ -1134,6 +1141,7 @@
 cancel_recv_cb(GaimXfer *xfer)
 {
 	gaim_xfer_request_denied(xfer);
+	gaim_xfer_unref(xfer);
 
 	return 0;
 }
@@ -1163,6 +1171,7 @@
 static void
 gaim_gtkxfer_request_file(GaimXfer *xfer)
 {
+	gaim_xfer_ref(xfer);
 	if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE)
 		gaim_gtkxfer_ask_recv(xfer);
 	else
--- a/src/protocols/yahoo/yahoo_filexfer.c	Tue Feb 17 15:58:20 2004 +0000
+++ b/src/protocols/yahoo/yahoo_filexfer.c	Tue Feb 17 18:45:25 2004 +0000
@@ -195,13 +195,20 @@
 	account = gaim_connection_get_account(gc);
 
 	if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) {
-		if (gaim_proxy_connect(account, gaim_account_get_string(account, "xfer_host",  YAHOO_XFER_HOST),
-		                       gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT),
-		                       yahoo_sendfile_connected, xfer) == -1)
-		{
+		if (gaim_xfer_get_size(xfer) >= 1048577) {
 			gaim_notify_error(gc, NULL, _("File Transfer Aborted"),
-			                 _("Unable to establish file descriptor."));
-			gaim_xfer_cancel_remote(xfer);
+			                  _("Gaim cannot send files over Yahoo! that are bigger than "
+			                    "One Megabyte (1,048,576 bytes)."));
+			gaim_xfer_cancel_local(xfer);
+		} else {
+			if (gaim_proxy_connect(account, gaim_account_get_string(account, "xfer_host",  YAHOO_XFER_HOST),
+			                       gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT),
+			                       yahoo_sendfile_connected, xfer) == -1)
+			{
+				gaim_notify_error(gc, NULL, _("File Transfer Aborted"),
+				                 _("Unable to establish file descriptor."));
+				gaim_xfer_cancel_remote(xfer);
+			}
 		}
 	} else {
 		xfer->fd = gaim_proxy_connect(account, xfer_data->host, xfer_data->port,