8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 18:43:03 +01:00

Fixed UnloadDetector in a case when it gets linked in non-plugin module

This commit is contained in:
alexpeshkoff 2011-06-14 11:34:26 +00:00
parent c9be5c00b8
commit 18ef64b242
5 changed files with 12 additions and 11 deletions

View File

@ -680,5 +680,5 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
Firebird::PluginManagerInterfacePtr pi(master); Firebird::PluginManagerInterfacePtr pi(master);
pi->registerPluginFactory(Firebird::PluginType::AuthUserManagement, "Legacy_Auth", &factory); pi->registerPluginFactory(Firebird::PluginType::AuthUserManagement, "Legacy_Auth", &factory);
pi->registerModule(&Firebird::myModule); Firebird::myModule->registerMe();
} }

View File

@ -243,19 +243,20 @@ public:
typedef void VoidNoParam(); typedef void VoidNoParam();
explicit UnloadDetectorHelper(MemoryPool&) explicit UnloadDetectorHelper(MemoryPool&)
: cleanup(NULL), flagOsUnload(true) : cleanup(NULL), flagOsUnload(false)
{ } { }
void registerMe()
{
PluginManagerInterfacePtr()->registerModule(this);
flagOsUnload = true;
}
~UnloadDetectorHelper() ~UnloadDetectorHelper()
{ {
if (flagOsUnload) if (flagOsUnload)
{ {
PluginManagerInterfacePtr pi; PluginManagerInterfacePtr()->unregisterModule(this);
if (pi)
{
pi->unregisterModule(this);
}
doClean(); doClean();
} }
} }

View File

@ -325,7 +325,7 @@ void registerEngine(IPluginManager* iPlugin)
{ {
myModule->setCleanup(shutdownBeforeUnload); myModule->setCleanup(shutdownBeforeUnload);
iPlugin->registerPluginFactory(PluginType::Provider, "Engine12", &engineFactory); iPlugin->registerPluginFactory(PluginType::Provider, "Engine12", &engineFactory);
iPlugin->registerModule(&myModule); myModule->registerMe();
} }
} // namespace Jrd } // namespace Jrd

View File

@ -759,7 +759,7 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{ {
PluginManagerInterfacePtr pi; PluginManagerInterfacePtr pi;
pi->registerPluginFactory(PluginType::ExternalEngine, "UDR", &factory); pi->registerPluginFactory(PluginType::ExternalEngine, "UDR", &factory);
pi->registerModule(&myModule); myModule->registerMe();
libraryName->assign("fbclient"); libraryName->assign("fbclient");
ModuleLoader::doctorModuleExtension(libraryName); ModuleLoader::doctorModuleExtension(libraryName);

View File

@ -128,7 +128,7 @@ static Firebird::SimpleFactory<TraceFactoryImpl> traceFactory;
void registerTrace(Firebird::IPluginManager* iPlugin) void registerTrace(Firebird::IPluginManager* iPlugin)
{ {
iPlugin->registerPluginFactory(Firebird::PluginType::Trace, "fbtrace", &traceFactory); iPlugin->registerPluginFactory(Firebird::PluginType::Trace, "fbtrace", &traceFactory);
iPlugin->registerModule(&Firebird::myModule); Firebird::myModule->registerMe();
} }