Added reference counter to SERVER_CONNECT_REC. Since it's being moved around

a lot in reconnects etc. this should make it easier to track when it's
supposed to be destroyed. Hopefully fixes a crash I assume is related to
this but couldn't find..


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1880 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-10-21 13:59:07 +00:00 committed by cras
commit 1256621041
10 changed files with 79 additions and 38 deletions

View file

@ -65,6 +65,18 @@ static SERVER_CONNECT_REC *create_server_connect(void)
return g_malloc0(sizeof(IRC_SERVER_CONNECT_REC));
}
static void destroy_server_connect(SERVER_CONNECT_REC *conn)
{
IRC_SERVER_CONNECT_REC *ircconn;
ircconn = IRC_SERVER_CONNECT(conn);
if (ircconn == NULL)
return;
g_free_not_null(ircconn->usermode);
g_free_not_null(ircconn->alternate_nick);
}
void irc_core_init(void)
{
CHAT_PROTOCOL_REC *rec;
@ -80,6 +92,7 @@ void irc_core_init(void)
rec->create_server_setup = create_server_setup;
rec->create_channel_setup = create_channel_setup;
rec->create_server_connect = create_server_connect;
rec->destroy_server_connect = destroy_server_connect;
rec->server_connect = (SERVER_REC *(*) (SERVER_CONNECT_REC *))
irc_server_connect;