mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
jabber: fix crash when disconnection timeout is reached
This commit is contained in:
parent
ea9a527606
commit
6900d52d80
15
src/jabber.c
15
src/jabber.c
@ -243,6 +243,14 @@ jabber_get_jid(void)
|
|||||||
return xmpp_conn_get_jid(jabber_conn.conn);
|
return xmpp_conn_get_jid(jabber_conn.conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
jabber_free_resources(void)
|
||||||
|
{
|
||||||
|
xmpp_conn_release(jabber_conn.conn);
|
||||||
|
xmpp_ctx_free(jabber_conn.ctx);
|
||||||
|
xmpp_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_message_handler(xmpp_conn_t * const conn,
|
_message_handler(xmpp_conn_t * const conn,
|
||||||
xmpp_stanza_t * const stanza, void * const userdata)
|
xmpp_stanza_t * const stanza, void * const userdata)
|
||||||
@ -306,13 +314,6 @@ _connection_handler(xmpp_conn_t * const conn,
|
|||||||
|
|
||||||
// received close stream response from server after disconnect
|
// received close stream response from server after disconnect
|
||||||
if (jabber_conn.conn_status == JABBER_DISCONNECTING) {
|
if (jabber_conn.conn_status == JABBER_DISCONNECTING) {
|
||||||
// free memory for connection object and context
|
|
||||||
xmpp_conn_release(jabber_conn.conn);
|
|
||||||
xmpp_ctx_free(jabber_conn.ctx);
|
|
||||||
|
|
||||||
// shutdown libstrophe
|
|
||||||
xmpp_shutdown();
|
|
||||||
|
|
||||||
jabber_conn.conn_status = JABBER_DISCONNECTED;
|
jabber_conn.conn_status = JABBER_DISCONNECTED;
|
||||||
jabber_conn.presence = PRESENCE_OFFLINE;
|
jabber_conn.presence = PRESENCE_OFFLINE;
|
||||||
|
|
||||||
|
@ -50,5 +50,6 @@ void jabber_send(const char * const msg, const char * const recipient);
|
|||||||
void jabber_update_presence(jabber_presence_t status, const char * const msg);
|
void jabber_update_presence(jabber_presence_t status, const char * const msg);
|
||||||
const char * jabber_get_jid(void);
|
const char * jabber_get_jid(void);
|
||||||
jabber_conn_status_t jabber_get_connection_status(void);
|
jabber_conn_status_t jabber_get_connection_status(void);
|
||||||
|
void jabber_free_resources(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -282,6 +282,7 @@ _shutdown_init(void)
|
|||||||
jabber_process_events();
|
jabber_process_events();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
jabber_free_resources();
|
||||||
|
|
||||||
_shutdown();
|
_shutdown();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user