mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:00:38 +01:00
Fixed #7510: Firebird regularly crashes soon after unload of udr_engine plugin
(cherry picked from commit aed9464ddc
)
This commit is contained in:
parent
c2378962e8
commit
23648019d8
@ -712,15 +712,26 @@ void* ExtEngineManager::ExternalContextImpl::setInfo(int code, void* value)
|
||||
//---------------------
|
||||
|
||||
|
||||
ExtEngineManager::Function::Function(thread_db* tdbb, ExtEngineManager* aExtManager,
|
||||
IExternalEngine* aEngine, RoutineMetadata* aMetadata, IExternalFunction* aFunction,
|
||||
const Jrd::Function* aUdf)
|
||||
ExtEngineManager::ExtRoutine::ExtRoutine(thread_db* tdbb, ExtEngineManager* aExtManager,
|
||||
IExternalEngine* aEngine, RoutineMetadata* aMetadata)
|
||||
: extManager(aExtManager),
|
||||
engine(aEngine),
|
||||
metadata(aMetadata),
|
||||
function(aFunction),
|
||||
udf(aUdf),
|
||||
database(tdbb->getDatabase())
|
||||
{
|
||||
engine->addRef();
|
||||
}
|
||||
|
||||
|
||||
//---------------------
|
||||
|
||||
|
||||
ExtEngineManager::Function::Function(thread_db* tdbb, ExtEngineManager* aExtManager,
|
||||
IExternalEngine* aEngine, RoutineMetadata* aMetadata, IExternalFunction* aFunction,
|
||||
const Jrd::Function* aUdf)
|
||||
: ExtRoutine(tdbb, aExtManager, aEngine, aMetadata),
|
||||
function(aFunction),
|
||||
udf(aUdf)
|
||||
{
|
||||
}
|
||||
|
||||
@ -755,12 +766,9 @@ void ExtEngineManager::Function::execute(thread_db* tdbb, UCHAR* inMsg, UCHAR* o
|
||||
ExtEngineManager::Procedure::Procedure(thread_db* tdbb, ExtEngineManager* aExtManager,
|
||||
IExternalEngine* aEngine, RoutineMetadata* aMetadata, IExternalProcedure* aProcedure,
|
||||
const jrd_prc* aPrc)
|
||||
: extManager(aExtManager),
|
||||
engine(aEngine),
|
||||
metadata(aMetadata),
|
||||
: ExtRoutine(tdbb, aExtManager, aEngine, aMetadata),
|
||||
procedure(aProcedure),
|
||||
prc(aPrc),
|
||||
database(tdbb->getDatabase())
|
||||
prc(aPrc)
|
||||
{
|
||||
}
|
||||
|
||||
@ -845,15 +853,12 @@ bool ExtEngineManager::ResultSet::fetch(thread_db* tdbb)
|
||||
ExtEngineManager::Trigger::Trigger(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb,
|
||||
ExtEngineManager* aExtManager, IExternalEngine* aEngine, RoutineMetadata* aMetadata,
|
||||
IExternalTrigger* aTrigger, const Jrd::Trigger* aTrg)
|
||||
: computedStatements(pool),
|
||||
extManager(aExtManager),
|
||||
engine(aEngine),
|
||||
metadata(aMetadata),
|
||||
: ExtRoutine(tdbb, aExtManager, aEngine, aMetadata),
|
||||
computedStatements(pool),
|
||||
trigger(aTrigger),
|
||||
trg(aTrg),
|
||||
fieldsPos(pool),
|
||||
varDecls(pool),
|
||||
database(tdbb->getDatabase()),
|
||||
computedCount(0)
|
||||
{
|
||||
jrd_rel* relation = trg->relation;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "../common/classes/rwlock.h"
|
||||
#include "../common/classes/ImplementHelper.h"
|
||||
#include "../common/StatementMetadata.h"
|
||||
#include "../common/classes/GetPlugins.h"
|
||||
|
||||
struct dsc;
|
||||
|
||||
@ -209,7 +210,20 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
class Function
|
||||
class ExtRoutine
|
||||
{
|
||||
public:
|
||||
ExtRoutine(thread_db* tdbb, ExtEngineManager* aExtManager,
|
||||
Firebird::IExternalEngine* aEngine, RoutineMetadata* aMetadata);
|
||||
|
||||
protected:
|
||||
ExtEngineManager* extManager;
|
||||
Firebird::AutoPlugin<Firebird::IExternalEngine> engine;
|
||||
Firebird::AutoPtr<RoutineMetadata> metadata;
|
||||
Database* database;
|
||||
};
|
||||
|
||||
class Function : public ExtRoutine
|
||||
{
|
||||
public:
|
||||
Function(thread_db* tdbb, ExtEngineManager* aExtManager,
|
||||
@ -222,17 +236,13 @@ public:
|
||||
void execute(thread_db* tdbb, UCHAR* inMsg, UCHAR* outMsg) const;
|
||||
|
||||
private:
|
||||
ExtEngineManager* extManager;
|
||||
Firebird::IExternalEngine* engine;
|
||||
Firebird::AutoPtr<RoutineMetadata> metadata;
|
||||
Firebird::IExternalFunction* function;
|
||||
const Jrd::Function* udf;
|
||||
Database* database;
|
||||
};
|
||||
|
||||
class ResultSet;
|
||||
|
||||
class Procedure
|
||||
class Procedure : public ExtRoutine
|
||||
{
|
||||
public:
|
||||
Procedure(thread_db* tdbb, ExtEngineManager* aExtManager,
|
||||
@ -245,12 +255,8 @@ public:
|
||||
ResultSet* open(thread_db* tdbb, UCHAR* inMsg, UCHAR* outMsg) const;
|
||||
|
||||
private:
|
||||
ExtEngineManager* extManager;
|
||||
Firebird::IExternalEngine* engine;
|
||||
Firebird::AutoPtr<RoutineMetadata> metadata;
|
||||
Firebird::IExternalProcedure* procedure;
|
||||
const jrd_prc* prc;
|
||||
Database* database;
|
||||
|
||||
friend class ResultSet;
|
||||
};
|
||||
@ -272,7 +278,7 @@ public:
|
||||
USHORT charSet;
|
||||
};
|
||||
|
||||
class Trigger
|
||||
class Trigger : public ExtRoutine
|
||||
{
|
||||
public:
|
||||
Trigger(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, ExtEngineManager* aExtManager,
|
||||
@ -291,15 +297,11 @@ public:
|
||||
Firebird::Array<NestConst<StmtNode>> computedStatements;
|
||||
|
||||
private:
|
||||
ExtEngineManager* extManager;
|
||||
Firebird::IExternalEngine* engine;
|
||||
Firebird::AutoPtr<RoutineMetadata> metadata;
|
||||
Firebird::AutoPtr<Format> format;
|
||||
Firebird::IExternalTrigger* trigger;
|
||||
const Jrd::Trigger* trg;
|
||||
Firebird::Array<USHORT> fieldsPos;
|
||||
Firebird::Array<const DeclareVariableNode*> varDecls;
|
||||
Database* database;
|
||||
USHORT computedCount;
|
||||
};
|
||||
|
||||
|
@ -275,7 +275,6 @@ public:
|
||||
info(*getDefaultMemoryPool()),
|
||||
children(*getDefaultMemoryPool())
|
||||
{
|
||||
engine->addRef();
|
||||
module = engine->loadModule(status, metadata, &moduleName, &entryPoint);
|
||||
|
||||
IUdrFunctionFactory* factory = engine->findNode<IUdrFunctionFactory>(
|
||||
@ -312,7 +311,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
AutoPlugin<Engine> engine;
|
||||
Engine* engine;
|
||||
IRoutineMetadata* metadata;
|
||||
PathName moduleName;
|
||||
string entryPoint;
|
||||
@ -338,7 +337,6 @@ public:
|
||||
info(*getDefaultMemoryPool()),
|
||||
children(*getDefaultMemoryPool())
|
||||
{
|
||||
engine->addRef();
|
||||
module = engine->loadModule(status, metadata, &moduleName, &entryPoint);
|
||||
|
||||
IUdrProcedureFactory* factory = engine->findNode<IUdrProcedureFactory>(
|
||||
@ -375,7 +373,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
AutoPlugin<Engine> engine;
|
||||
Engine* engine;
|
||||
IRoutineMetadata* metadata;
|
||||
PathName moduleName;
|
||||
string entryPoint;
|
||||
@ -400,7 +398,6 @@ public:
|
||||
info(*getDefaultMemoryPool()),
|
||||
children(*getDefaultMemoryPool())
|
||||
{
|
||||
engine->addRef();
|
||||
module = engine->loadModule(status, metadata, &moduleName, &entryPoint);
|
||||
|
||||
IUdrTriggerFactory* factory = engine->findNode<IUdrTriggerFactory>(
|
||||
@ -438,7 +435,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
AutoPlugin<Engine> engine;
|
||||
Engine* engine;
|
||||
IRoutineMetadata* metadata;
|
||||
PathName moduleName;
|
||||
string entryPoint;
|
||||
|
Loading…
Reference in New Issue
Block a user