From 179bcf228f516f1d06e648c533da8403ee6f48bd Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Wed, 23 May 2007 20:28:03 +0000 Subject: [PATCH] Do not call silc_client_stop before silc_client_init has been called. Fixed crash in SILC Plugin. --- CHANGES | 4 ++++ apps/irssi/src/silc/core/silc-core.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index fe2adfaf..d2da41ea 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,10 @@ Wed May 23 23:21:03 EEST 2007 Pekka Riikonen nicklist (/NAMES etc). Affected file is apps/irssi/src/silc/core/client_ops.c. + * Fixed SILC Plugin crash when stopping client library before + it has been started. Affected file is + apps/irssi/src/silc/core/silc-core.c. + Tue May 22 17:18:54 EEST 2007 Pekka Riikonen * For SILC Client and SILC Server check for 1.1 Toolkit diff --git a/apps/irssi/src/silc/core/silc-core.c b/apps/irssi/src/silc/core/silc-core.c index 3084f740..3f7677f2 100644 --- a/apps/irssi/src/silc/core/silc-core.c +++ b/apps/irssi/src/silc/core/silc-core.c @@ -51,6 +51,7 @@ static int init_failed = 0; #endif static int idletag = -1; +static int running = 0; /* SILC Client */ SilcClient silc_client = NULL; @@ -561,6 +562,7 @@ silc_stopped(SilcClient client, void *context) static void silc_running(SilcClient client, void *context) { + running = 1; SILC_LOG_DEBUG(("Client library is running")); } @@ -791,11 +793,12 @@ void silc_core_deinit(void) if (idletag != -1) g_source_remove(idletag); - int stopped = 0; - silc_client_stop(silc_client, silc_stopped, &stopped); - - while (!stopped) - silc_client_run_one(silc_client); + if (running) { + int stopped = 0; + silc_client_stop(silc_client, silc_stopped, &stopped); + while (!stopped) + silc_client_run_one(silc_client); + } if (opt_hostname) silc_free(opt_hostname); -- 2.24.0