summaryrefslogtreecommitdiff
path: root/src/perl
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2015-12-10 14:02:59 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2015-12-10 14:02:59 +0100
commit9dd2b7c616e48a7525e72d6798a0adae34720616 (patch)
tree231ff8c48185d7a364b5383adec46ba807062e67 /src/perl
parent4dc2bab4b4ae7ff05220c1121f0f11097f77b265 (diff)
downloadirssi-9dd2b7c616e48a7525e72d6798a0adae34720616.zip
deinit perl on staticperl builds
Diffstat (limited to 'src/perl')
-rw-r--r--src/perl/perl-core.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index 793f9375..2c0ca49d 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -82,16 +82,18 @@ static void perl_script_destroy(PERL_SCRIPT_REC *script)
extern void boot_DynaLoader(pTHX_ CV* cv);
#if PERL_STATIC_LIBS == 1
-extern void boot_Irssi(CV *cv);
+extern void boot_Irssi(pTHX_ CV *cv);
XS(boot_Irssi_Core)
{
dXSARGS;
+ PERL_UNUSED_VAR(items);
irssi_callXS(boot_Irssi, cv, mark);
irssi_boot(Irc);
irssi_boot(UI);
irssi_boot(TextUI);
+ /* Make sure to keep this in line with perl_scripts_deinit below. */
XSRETURN_YES;
}
#endif
@@ -155,6 +157,17 @@ void perl_scripts_deinit(void)
/* Unload all perl libraries loaded with dynaloader */
perl_eval_pv("foreach my $lib (@DynaLoader::dl_modules) { if ($lib =~ /^Irssi\\b/) { $lib .= '::deinit();'; eval $lib; } }", TRUE);
+#if PERL_STATIC_LIBS == 1
+ /* If perl is statically built we should manually deinit the modules
+ which are booted in boot_Irssi_Core above */
+ perl_eval_pv("foreach my $lib (qw("
+ "Irssi" " "
+ "Irssi::Irc" " "
+ "Irssi::UI" " "
+ "Irssi::TextUI"
+ ")) { eval $lib . '::deinit();'; }", TRUE);
+#endif
+
/* We could unload all libraries .. but this crashes with some
libraries, probably because we don't call some deinit function..
Anyway, this would free some memory with /SCRIPT RESET, but it