|
@@ -242,8 +242,8 @@ Procedure ReleasePostgres3;
|
|
|
|
|
|
function PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME : pchar) : ppgconn;
|
|
function PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME : pchar) : ppgconn;
|
|
|
|
|
|
-var Postgres3LibraryHandle : TLibHandle;
|
|
|
|
- Postgres3LoadedLibrary : String;
|
|
|
|
|
|
+var Postgres3LibraryHandle : TLibHandle= NilHandle;
|
|
|
|
+ Postgres3LoadedLibrary : String = '';
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
@@ -421,7 +421,7 @@ begin
|
|
EnterCriticalsection(libpgCriticalSection);
|
|
EnterCriticalsection(libpgCriticalSection);
|
|
try
|
|
try
|
|
if RefCount > 0 then dec(RefCount);
|
|
if RefCount > 0 then dec(RefCount);
|
|
- if RefCount = 0 then
|
|
|
|
|
|
+ if (RefCount = 0) and ( Postgres3LibraryHandle <> nilhandle) then
|
|
begin
|
|
begin
|
|
if not UnloadLibrary(Postgres3LibraryHandle) then inc(RefCount);
|
|
if not UnloadLibrary(Postgres3LibraryHandle) then inc(RefCount);
|
|
ReleaseDllist;
|
|
ReleaseDllist;
|