forked from PsychoticNinja/irssi
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:
parent
1b64509ae2
commit
ae1b5b0d50
@ -57,6 +57,7 @@ void log_away_init(void);
|
|||||||
void log_away_deinit(void);
|
void log_away_deinit(void);
|
||||||
|
|
||||||
int irssi_gui;
|
int irssi_gui;
|
||||||
|
int irssi_init_finished;
|
||||||
|
|
||||||
static char *irssi_dir, *irssi_config_file;
|
static char *irssi_dir, *irssi_config_file;
|
||||||
static GSList *dialog_type_queue, *dialog_text_queue;
|
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);
|
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[])
|
void core_init(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
dialog_type_queue = NULL;
|
dialog_type_queue = NULL;
|
||||||
@ -233,6 +239,7 @@ void core_init(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
read_settings();
|
read_settings();
|
||||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
|
signal_add("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);
|
||||||
|
|
||||||
settings_check();
|
settings_check();
|
||||||
|
|
||||||
@ -242,6 +249,7 @@ void core_init(int argc, char *argv[])
|
|||||||
void core_deinit(void)
|
void core_deinit(void)
|
||||||
{
|
{
|
||||||
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
|
signal_remove("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);
|
||||||
|
|
||||||
chat_commands_deinit();
|
chat_commands_deinit();
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#define IRSSI_GUI_KDE 5
|
#define IRSSI_GUI_KDE 5
|
||||||
|
|
||||||
extern int irssi_gui;
|
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[]);
|
void core_init_paths(int argc, char *argv[]);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define NEED_PERL_H
|
#define NEED_PERL_H
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
#include "core.h"
|
||||||
#include "signals.h"
|
#include "signals.h"
|
||||||
#include "misc.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)
|
void perl_core_init(void)
|
||||||
{
|
{
|
||||||
print_script_errors = 1;
|
print_script_errors = 1;
|
||||||
@ -395,7 +403,11 @@ void perl_core_init(void)
|
|||||||
signal_add_last("script error", (SIGNAL_FUNC) sig_script_error);
|
signal_add_last("script error", (SIGNAL_FUNC) sig_script_error);
|
||||||
|
|
||||||
perl_scripts_init();
|
perl_scripts_init();
|
||||||
|
|
||||||
|
if (irssi_init_finished)
|
||||||
perl_scripts_autorun();
|
perl_scripts_autorun();
|
||||||
|
else
|
||||||
|
signal_add("irssi init finished", (SIGNAL_FUNC) sig_autorun);
|
||||||
|
|
||||||
module_register("perl", "core");
|
module_register("perl", "core");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user