Page 1 of 1

Patch for TZPostgreSQLConnection

Posted: 05.04.2012, 07:18
by Shagrat3
Exception on destroy program

Haw it's make
Create new project
Append TZConnecttion, TZSQLMonitor
On Create
Make connection to server
When halt(0)

On Destroy
Make query ZConnection.ExecuteDirect

Patch:

Code: Select all

Index: ZDbcPostgreSql.pas
===================================================================
--- ZDbcPostgreSql.pas	(revision 1089)
+++ ZDbcPostgreSql.pas	(working copy)
@@ -746,13 +746,14 @@
 var
   LogMessage: string;
 begin
-  if not Closed then
-  begin
+  if not Closed then begin
     FPlainDriver.Finish(FHandle);
     FHandle := nil;
     LogMessage := Format('DISCONNECT FROM "%s"', [Database]);
-    DriverManager.LogMessage(lcDisconnect, FPlainDriver.GetProtocol, LogMessage);
+    if Assigned(DriverManager) then
+      DriverManager.LogMessage(lcDisconnect, FPlainDriver.GetProtocol, LogMessage);
   end;
+
   inherited Close;
 end;
Tested ON: Win7, Delphi XE2, Postgres 8.4

Posted: 05.04.2012, 18:16
by EgonHugeist
Does that mean the DriverManager is destroyed before your connection is freed an nilled? If this is true than we've the same issue on the other connections too. So can you post a example? It makes everything more clear.

Btw. what about you FastLocate-thread. Waiting for reply...

best regards