mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Merge pull request #1896 from H3rnand3zzz/fix/reconnect-crash
Fix 2 crashes on reconnection
This commit is contained in:
commit
c68e10c2c4
@ -6467,7 +6467,6 @@ cmd_reconnect(ProfWin* window, const char* const command, gchar** args)
|
||||
int intval = 0;
|
||||
auto_char char* err_msg = NULL;
|
||||
if (g_strcmp0(value, "now") == 0) {
|
||||
cons_show("Reconnecting now.");
|
||||
cl_ev_reconnect();
|
||||
} else if (strtoi_range(value, &intval, 0, INT_MAX, &err_msg)) {
|
||||
prefs_set_reconnect(intval);
|
||||
|
@ -98,7 +98,14 @@ cl_ev_disconnect(void)
|
||||
void
|
||||
cl_ev_reconnect(void)
|
||||
{
|
||||
if (connection_get_status() != JABBER_DISCONNECTED) {
|
||||
jabber_conn_status_t conn_status = connection_get_status();
|
||||
if (conn_status == JABBER_CONNECTING) {
|
||||
cons_show_error("Reconnection aborted: Connection attempt is already in progress");
|
||||
return;
|
||||
}
|
||||
|
||||
cons_show("Reconnecting now.");
|
||||
if (conn_status != JABBER_DISCONNECTED && conn_status != JABBER_DISCONNECTING) {
|
||||
connection_disconnect();
|
||||
ev_disconnect_cleanup();
|
||||
// on intentional disconnect reset the counter
|
||||
|
@ -312,7 +312,10 @@ win_get_title(ProfWin* window)
|
||||
{
|
||||
const ProfChatWin* chatwin = (ProfChatWin*)window;
|
||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||
const PContact contact = roster_get_contact(chatwin->barejid);
|
||||
PContact contact = NULL;
|
||||
if (roster_exists()) {
|
||||
contact = roster_get_contact(chatwin->barejid);
|
||||
}
|
||||
if (!contact) {
|
||||
return g_strdup(chatwin->barejid);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user