0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-28 15:53:46 +02:00

ircd::mods: Call module fini after child reference counts incremented.

This commit is contained in:
Jason Volk 2020-08-20 20:26:34 -07:00
parent af0fa4b2e8
commit f8b9652555

View file

@ -88,12 +88,6 @@ ircd::mods::unload(mod &mod)
mod.location()
};
// Call the user's unloading function here.
assert(mod.header);
assert(mod.header->meta);
if(mod.header->meta->fini)
mod.header->meta->fini();
// Save the children! dlclose() does not like to be called recursively during static
// destruction of a module. The mod ctor recorded all of the modules loaded while this
// module was loading so we can reverse the record and unload them here.
@ -106,6 +100,12 @@ ircd::mods::unload(mod &mod)
return shared_from(*ptr);
});
// Call the user's unloading function here.
assert(mod.header);
assert(mod.header->meta);
if(mod.header->meta->fini)
mod.header->meta->fini();
mapi::static_destruction = false;
mod.handle.unload();