diff options
author | Stephen Oberholtzer <stevie@qrpff.net> | 2017-02-28 23:48:56 -0500 |
---|---|---|
committer | Stephen Oberholtzer <stevie@qrpff.net> | 2017-02-28 23:48:56 -0500 |
commit | 5c4e6304ce12a3c94cc58eec01d4ef45db4dabc3 (patch) | |
tree | 791989e39f2eecc694d7cbd6d006309bb479da88 /src/perl | |
parent | fa1a0562916c2c8ef8f7087a59795973bf0927ac (diff) | |
download | irssi-5c4e6304ce12a3c94cc58eec01d4ef45db4dabc3.zip |
Don't emit the script destroyed signal before script is actually destroyed
The script unloading code originally worked like this:
1. Destroy package
2. Emit 'script destroyed' signal
3. Unhook script's signal handlers
If a script added a 'script destroyed' signal handler, unloading
that script would cause the 'script destroyed' signal to be sent to the
(already destroyed) package. This would cause a script error, which would
trigger a script unload, which would start the whole process over again,
until we run out of heap or stack space and segfault.
This commit simply reorders the operations so that the 'script destroyed'
signal is sent *after* the script is fully destroyed.
Diffstat (limited to 'src/perl')
-rw-r--r-- | src/perl/perl-core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index e4bde559..39389157 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -67,11 +67,11 @@ static void perl_script_destroy(PERL_SCRIPT_REC *script) { perl_scripts = g_slist_remove(perl_scripts, script); - signal_emit("script destroyed", 1, script); - perl_signal_remove_script(script); perl_source_remove_script(script); + signal_emit("script destroyed", 1, script); + g_free(script->name); g_free(script->package); g_free_not_null(script->path); |