Suspend DF around loading and unloading plugins.

This is necessary to improve safety of vtable interposing.
develop
Alexander Gavrilov 2012-08-23 19:51:55 +04:00
parent c6c5ad56c9
commit b12b9fa91e
2 changed files with 6 additions and 0 deletions

@ -1225,6 +1225,7 @@ int Core::Shutdown ( void )
if(errorstate)
return true;
errorstate = 1;
CoreSuspendClaimer suspend;
if(plug_mgr)
{
delete plug_mgr;

@ -195,6 +195,9 @@ bool Plugin::load(color_ostream &con)
{
return true;
}
// enter suspend
CoreSuspender suspend;
// open the library, etc
DFLibrary * plug = OpenPlugin(filename.c_str());
if(!plug)
{
@ -270,6 +273,8 @@ bool Plugin::unload(color_ostream &con)
}
// wait for all calls to finish
access->wait();
// enter suspend
CoreSuspender suspend;
// notify plugin about shutdown, if it has a shutdown function
command_result cr = CR_OK;
if(plugin_shutdown)