diff options
author | Timo Sirainen <cras@irssi.org> | 2001-07-31 01:22:32 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-07-31 01:22:32 +0000 |
commit | 137b3ae504b95b8d1f1b34ccdc34f419fe82e96f (patch) | |
tree | ea7b21e512f4cd21b01dc3fe0c6894fbe7eae200 /src/perl | |
parent | 642622624da6156c6e1c16651aa7970d81e86717 (diff) | |
download | irssi-137b3ae504b95b8d1f1b34ccdc34f419fe82e96f.zip |
Stop scripts when there's error in signal/timeout/input handler.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1694 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/perl')
-rw-r--r-- | src/perl/perl-core.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index 8b23c7fe..cadc0c4b 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -65,9 +65,11 @@ static void perl_script_destroy_package(PERL_SCRIPT_REC *script) static void perl_script_destroy(PERL_SCRIPT_REC *script) { - signal_emit("script destroyed", 1, script); + perl_scripts = g_slist_remove(perl_scripts, script); + + signal_emit("script destroyed", 1, script); - perl_signal_remove_package(script->package); + perl_signal_remove_package(script->package); perl_source_remove_package(script->package); g_free(script->name); @@ -75,8 +77,6 @@ static void perl_script_destroy(PERL_SCRIPT_REC *script) g_free_not_null(script->path); g_free_not_null(script->data); g_free(script); - - perl_scripts = g_slist_remove(perl_scripts, script); } /* Initialize perl interpreter */ @@ -349,10 +349,19 @@ static void perl_scripts_autorun(void) g_free(path); } +static void sig_script_error(PERL_SCRIPT_REC *script) +{ + if (script != NULL) { + perl_script_destroy(script); + signal_stop(); + } +} + void perl_core_init(void) { PL_perl_destruct_level = 1; perl_signals_init(); + signal_add_last("script error", (SIGNAL_FUNC) sig_script_error); perl_scripts_init(); perl_scripts_autorun(); @@ -362,4 +371,6 @@ void perl_core_deinit(void) { perl_signals_deinit(); perl_scripts_deinit(); + + signal_remove("script error", (SIGNAL_FUNC) sig_script_error); } |