mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Call message_handlers_clear() upon disconnect
Free pubsub_event_handlers. Fix memory leaks.
This commit is contained in:
parent
11b8204d14
commit
b8c8059402
@ -178,6 +178,14 @@ message_handlers_init(void)
|
||||
pubsub_event_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
|
||||
}
|
||||
|
||||
void
|
||||
message_handlers_clear(void)
|
||||
{
|
||||
if (pubsub_event_handlers) {
|
||||
g_hash_table_remove_all(pubsub_event_handlers);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
message_pubsub_event_handler_add(const char *const node, ProfMessageCallback func, ProfMessageFreeCallback free_func, void *userdata)
|
||||
{
|
||||
|
@ -39,6 +39,7 @@ typedef int(*ProfMessageCallback)(xmpp_stanza_t *const stanza, void *const userd
|
||||
typedef void(*ProfMessageFreeCallback)(void *userdata);
|
||||
|
||||
void message_handlers_init(void);
|
||||
void message_handlers_clear(void);
|
||||
void message_pubsub_event_handler_add(const char *const node, ProfMessageCallback func, ProfMessageFreeCallback free_func, void *userdata);
|
||||
|
||||
#endif
|
||||
|
@ -216,6 +216,7 @@ session_disconnect(void)
|
||||
iq_handlers_clear();
|
||||
|
||||
connection_disconnect();
|
||||
message_handlers_clear();
|
||||
|
||||
connection_clear_data();
|
||||
chat_sessions_clear();
|
||||
|
Loading…
Reference in New Issue
Block a user