Browse Source

Delphi 10.4 restricted FreeAndNil to objects so cannot be used on Records
conditional define added to src/config.ic to identify Delphi Version 10.4 and greater.
conditional FreeAndNil in /src/core/UNETProtocol TNetData.Destroy to manage this change

r_weetch 4 years ago
parent
commit
29f73ce41c
2 changed files with 9 additions and 0 deletions
  1. 4 0
      src/config.inc
  2. 5 0
      src/core/UNetProtocol.pas

+ 4 - 0
src/config.inc

@@ -111,6 +111,10 @@ ERROR: You must select ONLY ONE option: Use_OpenSSL or Use_CryptoLib4Pascal
   {$ELSE}
     {$UNDEF NO_ANSISTRING}
   {$ENDIF}
+  
+  {$IF COMPILERVERSION > 33}
+    {$DEFINE DELPHI_SYDNEY_PLUS}  
+  {$ENDIF}
 {$ENDIF}
 
 

+ 5 - 0
src/core/UNetProtocol.pas

@@ -1243,7 +1243,12 @@ Var l : TList<TNetConnection>;
   tdc : TThreadDiscoverConnection;
 begin
   TLog.NewLog(ltInfo,ClassName,'TNetData.Destroy START');
+  {$IFDEF DELPHI_SYDNEY_PLUS }
+  SetLength(FOnConnectivityChanged.Handlers, 0);
+  SetLength(FOnConnectivityChanged.MainThreadHandlers, 0);
+  {$ELSE}
   FreeAndNil(FOnConnectivityChanged);
+  {$ENDIF}
   FOnGetNewBlockchainFromClientDownloadNewSafebox := Nil;
   FOnStatisticsChanged := Nil;
   FOnNetConnectionsUpdated := Nil;