Browse Source

+ Fixed memory leak in TIPCCserver

git-svn-id: trunk@4212 -
michael 19 years ago
parent
commit
9ecfcf0e09
1 changed files with 13 additions and 6 deletions
  1. 13 6
      fcl/inc/simpleipc.pp

+ 13 - 6
fcl/inc/simpleipc.pp

@@ -242,6 +242,7 @@ end;
 destructor TSimpleIPCServer.destroy;
 destructor TSimpleIPCServer.destroy;
 begin
 begin
   Active:=False;
   Active:=False;
+  FreeAndNil(FMsgData);
   inherited destroy;
   inherited destroy;
 end;
 end;
 
 
@@ -268,17 +269,23 @@ end;
 
 
 procedure TSimpleIPCServer.StartServer;
 procedure TSimpleIPCServer.StartServer;
 begin
 begin
-  If (FServerID='') then
-    FServerID:=ApplicationName;
-  FIPCComm:=CommClass.Create(Self);
-  FIPCComm.StartServer;
+  if Not Assigned(FIPCComm) then
+    begin
+    If (FServerID='') then
+      FServerID:=ApplicationName;
+    FIPCComm:=CommClass.Create(Self);
+    FIPCComm.StartServer;
+    end;
   FActive:=True;
   FActive:=True;
 end;
 end;
 
 
 procedure TSimpleIPCServer.StopServer;
 procedure TSimpleIPCServer.StopServer;
 begin
 begin
-  FIPCComm.StopServer;
-  FreeAndNil(FIPCComm);
+  If Assigned(FIPCComm) then
+    begin
+    FIPCComm.StopServer;
+    FreeAndNil(FIPCComm);
+    end;
   FActive:=False;
   FActive:=False;
 end;
 end;