From 0f0e04603a1c8a08532764dddf76b8535e0bb80e Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Mon, 7 Jan 2013 22:13:24 +0200 Subject: added resources release to connetion handler --- src/chat_session.c | 3 ++- src/jabber.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/chat_session.c b/src/chat_session.c index 3cd50404..10465032 100644 --- a/src/chat_session.c +++ b/src/chat_session.c @@ -63,7 +63,8 @@ chat_sessions_init(void) void chat_sessions_clear(void) { - g_hash_table_remove_all(sessions); + if (sessions != NULL) + g_hash_table_remove_all(sessions); } void diff --git a/src/jabber.c b/src/jabber.c index 48495000..ffe4d2b6 100644 --- a/src/jabber.c +++ b/src/jabber.c @@ -527,7 +527,8 @@ jabber_free_resources(void) FREE_SET_NULL(saved_account); FREE_SET_NULL(saved_altdomain); chat_sessions_clear(); - g_hash_table_remove_all(sub_requests); + if (sub_requests != NULL) + g_hash_table_remove_all(sub_requests); xmpp_conn_release(jabber_conn.conn); xmpp_ctx_free(jabber_conn.ctx); xmpp_shutdown(); @@ -790,6 +791,9 @@ _connection_handler(xmpp_conn_t * const conn, if (prefs_get_reconnect() != 0) { assert(reconnect_timer == NULL); reconnect_timer = g_timer_new(); + // TODO: free resources but leave saved_* untouched + } else { + jabber_free_resources(); } // login attempt failed @@ -801,6 +805,7 @@ _connection_handler(xmpp_conn_t * const conn, if (prefs_get_reconnect() != 0) { g_timer_start(reconnect_timer); } + // TODO: free resources but leave saved_* untouched } } -- cgit 1.4.1-2-gfad0