0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd::js: Lock context and run js dtor even on bailout for now.

This commit is contained in:
Jason Volk 2016-10-18 17:11:55 -07:00
parent 4f34311f5f
commit b3c46af4a1

View file

@ -55,6 +55,7 @@ struct log::log log
//
ircd::js::init::init()
try
{
log.info("Initializing the JS engine [%s: %s]",
"SpiderMonkey",
@ -72,11 +73,27 @@ ircd::js::init::init()
mc = context(main, context_opts);
log.info("Initialized main JS Runtime and context (version: '%s')",
version(mc));
{
context::lock lock;
ircd::mods::load("kernel");
}
}
catch(...)
{
this->~init();
throw;
}
ircd::js::init::~init()
noexcept
{
if(cx && !!*cx)
{
context::lock lock;
ircd::mods::unload("kernel");
}
log.info("Terminating the main JS Runtime");
// Assign empty objects to free and reset