From c17439820d2c5a66c6ea8c17ba6be61a6da82582 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 15 Nov 2001 00:21:24 +0000 Subject: Don't crash when connecting to server with unknown chat protocol (eg. specified in config file but module not loaded yet). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2013 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/chat-protocols.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/chat-protocols.c b/src/core/chat-protocols.c index ab7c09d4..2989598c 100644 --- a/src/core/chat-protocols.c +++ b/src/core/chat-protocols.c @@ -156,7 +156,13 @@ void chat_protocol_unregister(const char *name) g_return_if_fail(name != NULL); rec = chat_protocol_find(name); - if (rec != NULL) chat_protocol_destroy(rec); + if (rec != NULL) { + chat_protocol_destroy(rec); + + /* there might still be references to this chat protocol - + recreate it as a dummy protocol */ + chat_protocol_get_unknown(name); + } } /* Default chat protocol to use */ @@ -190,6 +196,10 @@ static SERVER_CONNECT_REC *create_server_connect(void) return g_new0(SERVER_CONNECT_REC, 1); } +static void destroy_server_connect(SERVER_CONNECT_REC *conn) +{ +} + /* Return "unknown chat protocol" record. Used when protocol name is specified but it isn't registered yet. */ CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name) @@ -209,6 +219,7 @@ CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name) 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; newrec = chat_protocol_register(rec); g_free(rec); -- cgit v1.2.3