aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-03-03 21:49:21 -0300
committerdequis <dx@dxzone.com.ar>2015-03-11 18:24:15 -0300
commit3bb333cb89512308cbc3d569dfe2bf9bbcfc433d (patch)
tree9d5ba0d549c62935d9697a34847310cb0a9d87b9
parentafbad28d2029ba079e64450d17eb9a2fe7b20228 (diff)
purple: Implement 'close_request' to prevent segfaults after logout
Fixes trac bug 1190 ("Accepting SSL certs too late resets bitlbee-libpurple") To reproduce: 1. Connect to server with self-signed ssl certificate (downgrading to libpurple 2.10.9 might be required to actually get the request) 2. Disconnect the account 3. Type "yes" 4. Acquire segfault. Normally, query_del_by_conn() would handle this, but some requests have no account context at all. Yeah, it sucks. This is how pidgin handles it.
-rw-r--r--protocols/purple/purple.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c
index c3eb4a3b..004032c4 100644
--- a/protocols/purple/purple.c
+++ b/protocols/purple/purple.c
@@ -1047,6 +1047,19 @@ static void *prplcb_request_action(const char *title, const char *primary, const
return pqad;
}
+/* So it turns out some requests have no account context at all, because
+ * libpurple hates us. This means that query_del_by_conn() won't remove those
+ * on logout, and will segfault if the user replies. That's why this exists.
+ */
+static void prplcb_close_request(PurpleRequestType type, void *data)
+{
+ if (type == PURPLE_REQUEST_ACTION) {
+ struct prplcb_request_action_data *pqad = data;
+ query_del(local_bee->ui_data, pqad->bee_data);
+ }
+ /* Add the request input handler here when that becomes a thing */
+}
+
/*
static void prplcb_request_test()
{
@@ -1061,7 +1074,7 @@ static PurpleRequestUiOps bee_request_uiops =
prplcb_request_action,
NULL,
NULL,
- NULL,
+ prplcb_close_request,
NULL,
};