1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Merge pull request #378 from ailin-nemui/staticperl

deinit perl on staticperl builds
This commit is contained in:
dx 2015-12-12 12:40:38 -03:00
commit 4dd7f2b18f

View File

@ -82,16 +82,18 @@ static void perl_script_destroy(PERL_SCRIPT_REC *script)
extern void boot_DynaLoader(pTHX_ CV* cv); extern void boot_DynaLoader(pTHX_ CV* cv);
#if PERL_STATIC_LIBS == 1 #if PERL_STATIC_LIBS == 1
extern void boot_Irssi(CV *cv); extern void boot_Irssi(pTHX_ CV *cv);
XS(boot_Irssi_Core) XS(boot_Irssi_Core)
{ {
dXSARGS; dXSARGS;
PERL_UNUSED_VAR(items);
irssi_callXS(boot_Irssi, cv, mark); irssi_callXS(boot_Irssi, cv, mark);
irssi_boot(Irc); irssi_boot(Irc);
irssi_boot(UI); irssi_boot(UI);
irssi_boot(TextUI); irssi_boot(TextUI);
/* Make sure to keep this in line with perl_scripts_deinit below. */
XSRETURN_YES; XSRETURN_YES;
} }
#endif #endif
@ -155,6 +157,17 @@ void perl_scripts_deinit(void)
/* Unload all perl libraries loaded with dynaloader */ /* 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); 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 /* We could unload all libraries .. but this crashes with some
libraries, probably because we don't call some deinit function.. libraries, probably because we don't call some deinit function..
Anyway, this would free some memory with /SCRIPT RESET, but it Anyway, this would free some memory with /SCRIPT RESET, but it