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:
parent
034e75ee19
commit
51db872da0
@ -13,13 +13,12 @@ sub is_static {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub destroy {
|
sub destroy {
|
||||||
my $package = "Irssi::Script::".$_[0];
|
delete_package($_[0]);
|
||||||
delete_package($package);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub eval_data {
|
sub eval_data {
|
||||||
my ($data, $id) = @_;
|
my ($data, $id) = @_;
|
||||||
destroy($id);
|
destroy("Irssi::Script::$id");
|
||||||
|
|
||||||
my $package = "Irssi::Script::$id";
|
my $package = "Irssi::Script::$id";
|
||||||
my $eval = qq{package $package; %s sub handler { $data; }};
|
my $eval = qq{package $package; %s sub handler { $data; }};
|
||||||
|
@ -144,9 +144,9 @@ void perl_scripts_deinit(void)
|
|||||||
if (my_perl == NULL)
|
if (my_perl == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* destroy all scripts */
|
/* unload all scripts */
|
||||||
while (perl_scripts != NULL)
|
while (perl_scripts != NULL)
|
||||||
perl_script_destroy(perl_scripts->data);
|
perl_script_unload(perl_scripts->data);
|
||||||
|
|
||||||
signal_emit("perl scripts deinit", 0);
|
signal_emit("perl scripts deinit", 0);
|
||||||
|
|
||||||
@ -164,15 +164,6 @@ void perl_scripts_deinit(void)
|
|||||||
my_perl = NULL;
|
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)
|
static char *script_file_get_name(const char *path)
|
||||||
{
|
{
|
||||||
char *name, *ret, *p;
|
char *name, *ret, *p;
|
||||||
@ -300,6 +291,15 @@ PERL_SCRIPT_REC *perl_script_load_data(const char *data)
|
|||||||
return script_load(name, NULL, 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 */
|
/* Find loaded script by name */
|
||||||
PERL_SCRIPT_REC *perl_script_find(const char *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) {
|
if (script != NULL) {
|
||||||
perl_script_destroy(script);
|
perl_script_unload(script);
|
||||||
signal_stop();
|
signal_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user