1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

added irssi_init_finished variable to core.h which is TRUE after "irssi init

finished" signal is sent.

Perl scripts aren't now autoloaded until irssi_init_finished is TRUE (fixes
the crash at startup).


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1879 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-10-21 13:22:28 +00:00 committed by cras
parent 1b64509ae2
commit ae1b5b0d50
3 changed files with 22 additions and 1 deletions

View File

@ -57,6 +57,7 @@ void log_away_init(void);
void log_away_deinit(void);
int irssi_gui;
int irssi_init_finished;
static char *irssi_dir, *irssi_config_file;
static GSList *dialog_type_queue, *dialog_text_queue;
@ -188,6 +189,11 @@ void core_init_paths(int argc, char *argv[])
irssi_config_file = g_strdup_printf("%s/config", irssi_dir);
}
static void sig_irssi_init_finished(void)
{
irssi_init_finished = TRUE;
}
void core_init(int argc, char *argv[])
{
dialog_type_queue = NULL;
@ -233,6 +239,7 @@ void core_init(int argc, char *argv[])
#endif
read_settings();
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
signal_add("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);
settings_check();
@ -242,6 +249,7 @@ void core_init(int argc, char *argv[])
void core_deinit(void)
{
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
signal_remove("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);
chat_commands_deinit();

View File

@ -10,6 +10,7 @@
#define IRSSI_GUI_KDE 5
extern int irssi_gui;
extern int irssi_init_finished; /* TRUE after "irssi init finished" signal is sent */
void core_init_paths(int argc, char *argv[]);

View File

@ -21,6 +21,7 @@
#define NEED_PERL_H
#include "module.h"
#include "modules.h"
#include "core.h"
#include "signals.h"
#include "misc.h"
@ -386,6 +387,13 @@ static void sig_script_error(PERL_SCRIPT_REC *script, const char *error)
}
}
static void sig_autorun()
{
signal_remove("irssi init finished", (SIGNAL_FUNC) sig_autorun);
perl_scripts_autorun();
}
void perl_core_init(void)
{
print_script_errors = 1;
@ -395,7 +403,11 @@ void perl_core_init(void)
signal_add_last("script error", (SIGNAL_FUNC) sig_script_error);
perl_scripts_init();
perl_scripts_autorun();
if (irssi_init_finished)
perl_scripts_autorun();
else
signal_add("irssi init finished", (SIGNAL_FUNC) sig_autorun);
module_register("perl", "core");
}