mirror of
https://github.com/profanity-im/profanity.git
synced 2024-10-27 20:30:13 -04:00
Fix crash on quick /reconnect now
usage (double free)
Check connection state before reconnection. Fix #1894 https://github.com/profanity-im/profanity/issues/1894
This commit is contained in:
parent
634cb586d9
commit
be42ffcee9
@ -6467,7 +6467,6 @@ cmd_reconnect(ProfWin* window, const char* const command, gchar** args)
|
|||||||
int intval = 0;
|
int intval = 0;
|
||||||
auto_char char* err_msg = NULL;
|
auto_char char* err_msg = NULL;
|
||||||
if (g_strcmp0(value, "now") == 0) {
|
if (g_strcmp0(value, "now") == 0) {
|
||||||
cons_show("Reconnecting now.");
|
|
||||||
cl_ev_reconnect();
|
cl_ev_reconnect();
|
||||||
} else if (strtoi_range(value, &intval, 0, INT_MAX, &err_msg)) {
|
} else if (strtoi_range(value, &intval, 0, INT_MAX, &err_msg)) {
|
||||||
prefs_set_reconnect(intval);
|
prefs_set_reconnect(intval);
|
||||||
|
@ -98,7 +98,14 @@ cl_ev_disconnect(void)
|
|||||||
void
|
void
|
||||||
cl_ev_reconnect(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();
|
connection_disconnect();
|
||||||
ev_disconnect_cleanup();
|
ev_disconnect_cleanup();
|
||||||
// on intentional disconnect reset the counter
|
// on intentional disconnect reset the counter
|
||||||
|
Loading…
Reference in New Issue
Block a user