mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Attempted fix at causing segfault by freeing connection
This commit is contained in:
parent
ea9a527606
commit
d2aeca9bb4
18
src/jabber.c
18
src/jabber.c
@ -70,6 +70,17 @@ jabber_init(const int disable_tls)
|
||||
jabber_conn.tls_disabled = disable_tls;
|
||||
}
|
||||
|
||||
void
|
||||
jabber_shutdown(void)
|
||||
{
|
||||
// free memory for connection and context
|
||||
xmpp_conn_release(jabber_conn.conn);
|
||||
xmpp_ctx_free(jabber_conn.ctx);
|
||||
|
||||
// shutdown libstrophe
|
||||
xmpp_shutdown();
|
||||
}
|
||||
|
||||
jabber_conn_status_t
|
||||
jabber_connect(const char * const user,
|
||||
const char * const passwd)
|
||||
@ -306,13 +317,6 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
|
||||
// received close stream response from server after disconnect
|
||||
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.presence = PRESENCE_OFFLINE;
|
||||
|
||||
|
@ -41,6 +41,7 @@ typedef enum {
|
||||
} jabber_presence_t;
|
||||
|
||||
void jabber_init(const int disable_tls);
|
||||
void jabber_shutdown(void);
|
||||
jabber_conn_status_t jabber_connect(const char * const user,
|
||||
const char * const passwd);
|
||||
gboolean jabber_disconnect(void);
|
||||
|
@ -281,6 +281,7 @@ _shutdown_init(void)
|
||||
while (jabber_get_connection_status() == JABBER_DISCONNECTING) {
|
||||
jabber_process_events();
|
||||
}
|
||||
jabber_shutdown();
|
||||
}
|
||||
|
||||
_shutdown();
|
||||
|
Loading…
Reference in New Issue
Block a user