1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

/SCRIPT UNLOAD didn't destroy the perl package from memory. Also the scripts

weren't destroyed when error occured in them.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2053 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-11-18 16:16:13 +00:00 committed by cras
parent 034e75ee19
commit 51db872da0
2 changed files with 14 additions and 15 deletions

View File

@ -13,13 +13,12 @@ sub is_static {
}
sub destroy {
my $package = "Irssi::Script::".$_[0];
delete_package($package);
delete_package($_[0]);
}
sub eval_data {
my ($data, $id) = @_;
destroy($id);
destroy("Irssi::Script::$id");
my $package = "Irssi::Script::$id";
my $eval = qq{package $package; %s sub handler { $data; }};

View File

@ -144,9 +144,9 @@ void perl_scripts_deinit(void)
if (my_perl == NULL)
return;
/* destroy all scripts */
/* unload all scripts */
while (perl_scripts != NULL)
perl_script_destroy(perl_scripts->data);
perl_script_unload(perl_scripts->data);
signal_emit("perl scripts deinit", 0);
@ -164,15 +164,6 @@ void perl_scripts_deinit(void)
my_perl = NULL;
}
/* Unload perl script */
void perl_script_unload(PERL_SCRIPT_REC *script)
{
g_return_if_fail(script != NULL);
perl_script_destroy_package(script);
perl_script_destroy(script);
}
static char *script_file_get_name(const char *path)
{
char *name, *ret, *p;
@ -300,6 +291,15 @@ PERL_SCRIPT_REC *perl_script_load_data(const char *data)
return script_load(name, NULL, data);
}
/* Unload perl script */
void perl_script_unload(PERL_SCRIPT_REC *script)
{
g_return_if_fail(script != NULL);
perl_script_destroy_package(script);
perl_script_destroy(script);
}
/* Find loaded script by name */
PERL_SCRIPT_REC *perl_script_find(const char *name)
{
@ -415,7 +415,7 @@ static void sig_script_error(PERL_SCRIPT_REC *script, const char *error)
}
if (script != NULL) {
perl_script_destroy(script);
perl_script_unload(script);
signal_stop();
}
}