comparison libpurple/ft.c @ 29206: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
comparison
equal deleted inserted replaced
29205:df5808d7e669 29206:16dfa8df7dd1
310 310
311 g_free(dir); 311 g_free(dir);
312 } 312 }
313 else { 313 else {
314 purple_xfer_show_file_error(xfer, filename); 314 purple_xfer_show_file_error(xfer, filename);
315 purple_xfer_request_denied(xfer); 315 purple_xfer_cancel_local(xfer);
316 } 316 }
317 } 317 }
318 else if ((type == PURPLE_XFER_SEND) && (st.st_size == 0)) { 318 else if ((type == PURPLE_XFER_SEND) && (st.st_size == 0)) {
319 319
320 purple_notify_error(NULL, NULL, 320 purple_notify_error(NULL, NULL,
321 _("Cannot send a file of 0 bytes."), NULL); 321 _("Cannot send a file of 0 bytes."), NULL);
322 322
323 purple_xfer_request_denied(xfer); 323 purple_xfer_cancel_local(xfer);
324 } 324 }
325 else if ((type == PURPLE_XFER_SEND) && S_ISDIR(st.st_mode)) { 325 else if ((type == PURPLE_XFER_SEND) && S_ISDIR(st.st_mode)) {
326 /* 326 /*
327 * XXX - Sending a directory should be valid for some protocols. 327 * XXX - Sending a directory should be valid for some protocols.
328 */ 328 */
329 purple_notify_error(NULL, NULL, 329 purple_notify_error(NULL, NULL,
330 _("Cannot send a directory."), NULL); 330 _("Cannot send a directory."), NULL);
331 331
332 purple_xfer_request_denied(xfer); 332 purple_xfer_cancel_local(xfer);
333 } 333 }
334 else if ((type == PURPLE_XFER_RECEIVE) && S_ISDIR(st.st_mode)) { 334 else if ((type == PURPLE_XFER_RECEIVE) && S_ISDIR(st.st_mode)) {
335 char *msg, *utf8; 335 char *msg, *utf8;
336 utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL); 336 utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
337 msg = g_strdup_printf( 337 msg = g_strdup_printf(
369 purple_xfer_choose_file_cancel_cb(void *user_data, const char *filename) 369 purple_xfer_choose_file_cancel_cb(void *user_data, const char *filename)
370 { 370 {
371 PurpleXfer *xfer = (PurpleXfer *)user_data; 371 PurpleXfer *xfer = (PurpleXfer *)user_data;
372 372
373 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); 373 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL);
374 purple_xfer_request_denied(xfer); 374 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND)
375 purple_xfer_cancel_local(xfer);
376 else
377 purple_xfer_request_denied(xfer);
375 purple_xfer_unref(xfer); 378 purple_xfer_unref(xfer);
376 } 379 }
377 380
378 static int 381 static int
379 purple_xfer_choose_file(PurpleXfer *xfer) 382 purple_xfer_choose_file(PurpleXfer *xfer)