THRIFT-2162 Missing calls to inherited CTOR at misc. places

Patch: Jens Geyer
diff --git a/lib/delphi/src/Thrift.Collections.pas b/lib/delphi/src/Thrift.Collections.pas
index 66ff1c0..3a0274c 100644
--- a/lib/delphi/src/Thrift.Collections.pas
+++ b/lib/delphi/src/Thrift.Collections.pas
@@ -320,6 +320,7 @@
 

 constructor TThriftDictionaryImpl<TKey, TValue>.Create(ACapacity: Integer);

 begin

+  inherited Create;

   FDictionaly := TDictionary<TKey,TValue>.Create( ACapacity );

 end;

 

@@ -449,6 +450,7 @@
 

 constructor TThriftListImpl<T>.Create;

 begin

+  inherited;

   FList := TList<T>.Create;

 end;

 

diff --git a/lib/delphi/src/Thrift.Console.pas b/lib/delphi/src/Thrift.Console.pas
index 324efc3..5d1345b 100644
--- a/lib/delphi/src/Thrift.Console.pas
+++ b/lib/delphi/src/Thrift.Console.pas
@@ -84,6 +84,7 @@
 

 constructor TGUIConsole.Create( AMemo: TMemo);

 begin

+  inherited Create;

   FMemo := AMemo;

   FLineBreak := True;

 end;

diff --git a/lib/delphi/src/Thrift.Protocol.pas b/lib/delphi/src/Thrift.Protocol.pas
index 1f27203..e88f1cf 100644
--- a/lib/delphi/src/Thrift.Protocol.pas
+++ b/lib/delphi/src/Thrift.Protocol.pas
@@ -516,6 +516,7 @@
 constructor TFieldImpl.Create(const AName: string; const AType: TType;

   AId: SmallInt);

 begin

+  inherited Create;

   FName := AName;

   FType := AType;

   FId := AId;

@@ -523,6 +524,7 @@
 

 constructor TFieldImpl.Create;

 begin

+  inherited Create;

   FName := '';

   FType := Low(TType);

   FId   := 0;

@@ -702,7 +704,7 @@
 

 constructor TMapImpl.Create;

 begin

-

+  inherited Create;

 end;

 

 function TMapImpl.GetCount: Integer;

@@ -792,7 +794,7 @@
 

 constructor TSetImpl.Create;

 begin

-

+  inherited Create;

 end;

 

 function TSetImpl.GetCount: Integer;

@@ -826,7 +828,7 @@
 

 constructor TListImpl.Create;

 begin

-

+  inherited Create;

 end;

 

 function TListImpl.GetCount: Integer;

@@ -853,6 +855,7 @@
 

 constructor TBinaryProtocolImpl.Create( const trans: ITransport);

 begin

+  //no inherited

   Create( trans, False, True);

 end;

 

@@ -1253,12 +1256,14 @@
 

 constructor TBinaryProtocolImpl.TFactory.Create(AStrictRead, AStrictWrite: Boolean);

 begin

+  inherited Create;

   FStrictRead := AStrictRead;

   FStrictWrite := AStrictWrite;

 end;

 

 constructor TBinaryProtocolImpl.TFactory.Create;

 begin

+  //no inherited;  

   Create( False, True )

 end;

 

diff --git a/lib/delphi/src/Thrift.Serializer.pas b/lib/delphi/src/Thrift.Serializer.pas
index dce6863..43b5d29 100644
--- a/lib/delphi/src/Thrift.Serializer.pas
+++ b/lib/delphi/src/Thrift.Serializer.pas
@@ -86,6 +86,7 @@
 constructor TSerializer.Create();
 // Create a new TSerializer that uses the TBinaryProtocol by default.
 begin
+  //no inherited;  
   Create( TBinaryProtocolImpl.TFactory.Create);
 end;
 
@@ -156,6 +157,7 @@
 constructor TDeserializer.Create();
 // Create a new TDeserializer that uses the TBinaryProtocol by default.
 begin
+  //no inherited;  
   Create( TBinaryProtocolImpl.TFactory.Create);
 end;
 
diff --git a/lib/delphi/src/Thrift.Server.pas b/lib/delphi/src/Thrift.Server.pas
index e6ab7ac..7d39f6b 100644
--- a/lib/delphi/src/Thrift.Server.pas
+++ b/lib/delphi/src/Thrift.Server.pas
@@ -120,6 +120,7 @@
   InputTransFactory := TTransportFactoryImpl.Create;
   OutputTransFactory := TTransportFactoryImpl.Create;
 
+  //no inherited;  
   Create(
     AProcessor,
     AServerTransport,
@@ -143,6 +144,7 @@
   InputTransFactory := TTransportFactoryImpl.Create;
   OutputTransFactory := TTransportFactoryImpl.Create;
 
+  //no inherited;  
   Create(
     AProcessor,
     AServerTransport,
@@ -163,6 +165,7 @@
   InputProtocolFactory := TBinaryProtocolImpl.TFactory.Create;
   OutputProtocolFactory := TBinaryProtocolImpl.TFactory.Create;
 
+  //no inherited;  
   Create( AProcessor, AServerTransport, ATransportFactory, ATransportFactory,
     InputProtocolFactory, OutputProtocolFactory, DefaultLogDelegate);
 end;
@@ -173,6 +176,7 @@
   const AInputProtocolFactory, AOutputProtocolFactory: IProtocolFactory;
   const ALogDelegate : TLogDelegate);
 begin
+  inherited Create;
   FProcessor := AProcessor;
   FServerTransport := AServerTransport;
   FInputTransportFactory := AInputTransportFactory;
@@ -191,6 +195,7 @@
   const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory;
   const AProtocolFactory: IProtocolFactory);
 begin
+  //no inherited;  
   Create( AProcessor, AServerTransport,
           ATransportFactory, ATransportFactory,
           AProtocolFactory, AProtocolFactory,
diff --git a/lib/delphi/src/Thrift.Stream.pas b/lib/delphi/src/Thrift.Stream.pas
index 81d5d2a..c08f5ea 100644
--- a/lib/delphi/src/Thrift.Stream.pas
+++ b/lib/delphi/src/Thrift.Stream.pas
@@ -98,6 +98,7 @@
 

 constructor TThriftStreamAdapterCOM.Create( const AStream: IStream);

 begin

+  inherited Create;

   FStream := AStream;

 end;

 

@@ -221,6 +222,7 @@
 

 constructor TThriftStreamAdapterDelphi.Create( const AStream: TStream; AOwnsStream: Boolean);

 begin

+  inherited Create;

   FStream := AStream;

   FOwnsStream := AOwnsStream;

 end;

diff --git a/lib/delphi/src/Thrift.Transport.pas b/lib/delphi/src/Thrift.Transport.pas
index 8668e5a..0d5b384 100644
--- a/lib/delphi/src/Thrift.Transport.pas
+++ b/lib/delphi/src/Thrift.Transport.pas
@@ -502,6 +502,7 @@
 

 constructor TTransportException.Create(AType: TExceptionType);

 begin

+  //no inherited;  

   Create( AType, '' )

 end;

 

@@ -539,17 +540,20 @@
 

 constructor TServerSocketImpl.Create( const AServer: TTcpServer; AClientTimeout: Integer);

 begin

+  inherited Create;

   FServer := AServer;

   FClientTimeout := AClientTimeout;

 end;

 

 constructor TServerSocketImpl.Create( const AServer: TTcpServer);

 begin

+  //no inherited;  

   Create( AServer, 0 );

 end;

 

 constructor TServerSocketImpl.Create(APort: Integer);

 begin

+  //no inherited;  

   Create( APort, 0 );

 end;

 

@@ -616,6 +620,7 @@
 constructor TServerSocketImpl.Create(APort, AClientTimeout: Integer;

   AUseBufferedSockets: Boolean);

 begin

+  inherited Create;

   FPort := APort;

   FClientTimeout := AClientTimeout;

   FUseBufferedSocket := AUseBufferedSockets;

@@ -655,6 +660,7 @@
 

 constructor TServerSocketImpl.Create(APort, AClientTimeout: Integer);

 begin

+  //no inherited;  

   Create( APort, AClientTimeout, False );

 end;

 

@@ -666,27 +672,25 @@
 begin

   FClient := AClient;

   stream := TTcpSocketStreamImpl.Create( FClient);

-  FInputStream := stream;

-  FOutputStream := stream;

+  inherited Create( stream, stream);

 end;

 

 constructor TSocketImpl.Create(const AHost: string; APort: Integer);

 begin

+  //no inherited;  

   Create( AHost, APort, 0);

 end;

 

 procedure TSocketImpl.Close;

 begin

   inherited Close;

-  if FClient <> nil then

-  begin

-    FClient.Free;

-    FClient := nil;

-  end;

+  if FClient <> nil

+  then FreeAndNil( FClient);

 end;

 

 constructor TSocketImpl.Create(const AHost: string; APort, ATimeout: Integer);

 begin

+  inherited Create(nil,nil);

   FHost := AHost;

   FPort := APort;

   FTimeout := ATimeout;

@@ -781,6 +785,7 @@
 

 constructor TBufferedStreamImpl.Create( const AStream: IThriftStream; ABufSize: Integer);

 begin

+  inherited Create;

   FStream := AStream;

   FBufSize := ABufSize;

   FReadBuffer := TMemoryStream.Create;

@@ -916,6 +921,7 @@
 

 constructor TStreamTransportImpl.Create( const AInputStream : IThriftStream; const AOutputStream : IThriftStream);

 begin

+  inherited Create;

   FInputStream := AInputStream;

   FOutputStream := AOutputStream;

 end;

@@ -980,6 +986,7 @@
 

 constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport);

 begin

+  //no inherited;  

   Create( ATransport, 1024 );

 end;

 

@@ -991,6 +998,7 @@
 constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport;

   ABufSize: Integer);

 begin

+  inherited Create;

   FTransport := ATransport;

   FBufSize := ABufSize;

   InitBuffers;

@@ -1067,6 +1075,7 @@
 

 constructor TFramedTransportImpl.Create;

 begin

+  inherited Create;

   InitWriteBuffer;

 end;

 

@@ -1077,6 +1086,7 @@
 

 constructor TFramedTransportImpl.Create( const ATrans: ITransport);

 begin

+  inherited Create;

   InitWriteBuffer;

   FTransport := ATrans;

 end;

@@ -1206,6 +1216,7 @@
 

 constructor TTcpSocketStreamImpl.Create( const ATcpClient: TCustomIpClient);

 begin

+  inherited Create;

   FTcpClient := ATcpClient;

 end;

 

diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas
index 37fe7d7..e63bd4c 100644
--- a/lib/delphi/test/TestClient.pas
+++ b/lib/delphi/test/TestClient.pas
@@ -66,7 +66,9 @@
 
     procedure ClientTest;
     procedure JSONProtocolReadWriteTest;
+    {$IFDEF StressTest}
     procedure StressTest(const client : TThriftTest.Iface);
+    {$ENDIF}
   protected
     procedure Execute; override;
   public
@@ -859,6 +861,7 @@
 end;
 
 
+{$IFDEF StressTest}
 procedure TClientThread.StressTest(const client : TThriftTest.Iface);
 begin
   while TRUE do begin
@@ -875,7 +878,7 @@
     end;
   end;
 end;
-
+{$ENDIF}
 
 procedure TClientThread.JSONProtocolReadWriteTest;
 // Tests only then read/write procedures of the JSON protocol
@@ -1080,6 +1083,7 @@
 
 constructor TThreadConsole.Create(AThread: TThread);
 begin
+  inherited Create;
   FThread := AThread;
 end;
 
diff --git a/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas b/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas
index 2cc7ab0..a1af40b 100644
--- a/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas
+++ b/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas
@@ -78,6 +78,7 @@
 
 constructor TTestClient.Create( const args: array of string);
 begin
+  inherited;  
   ParseArgs(args);
   Setup;
 end;