Mercurial > pidgin
comparison libpurple/ft.c @ 30954:a76cf8ecb0c5
Close open requests related to this xfer when the request is canceled
locally. For oscar this includes disconnecting when you have an
incoming transfer request. Without this change Pidgin will crash if
the user tries to interact with the dialog. This change fixes #11666.
Now instead of crashing we'll leak. See the lengthy comment in the
code if anyone wants to fix this.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 22 Nov 2010 09:16:49 +0000 |
parents | 485eaf544bb0 |
children | a8cc50c2279f |
comparison
equal
deleted
inserted
replaced
30953:5eb2ea662d8c | 30954:a76cf8ecb0c5 |
---|---|
1485 { | 1485 { |
1486 PurpleXferUiOps *ui_ops; | 1486 PurpleXferUiOps *ui_ops; |
1487 char *msg = NULL; | 1487 char *msg = NULL; |
1488 | 1488 |
1489 g_return_if_fail(xfer != NULL); | 1489 g_return_if_fail(xfer != NULL); |
1490 | |
1491 /* TODO: We definitely want to close any open request dialogs associated | |
1492 with this transfer. However, in some cases the request dialog might | |
1493 own a reference on the xfer. This happens at least with the "%s wants | |
1494 to send you %s" dialog from purple_xfer_ask_recv(). In these cases | |
1495 the ref count will not be decremented when the request dialog is | |
1496 closed, so the ref count will never reach 0 and the xfer will never | |
1497 be freed. This is a memleak and should be fixed. It's not clear what | |
1498 the correct fix is. Probably requests should have a destroy function | |
1499 that is called when the request is destroyed. But also, ref counting | |
1500 xfer objects makes this code REALLY complicated. An alternate fix is | |
1501 to not ref count and instead just make sure the object still exists | |
1502 when we try to use it. */ | |
1503 purple_request_close_with_handle(xfer); | |
1490 | 1504 |
1491 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); | 1505 purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); |
1492 xfer->end_time = time(NULL); | 1506 xfer->end_time = time(NULL); |
1493 | 1507 |
1494 if (purple_xfer_get_filename(xfer) != NULL) | 1508 if (purple_xfer_get_filename(xfer) != NULL) |