Răsfoiți Sursa

* Fix AV when DebugDisabled is true and the program quits

git-svn-id: trunk@11841 -
joost 17 ani în urmă
părinte
comite
64cabb39d8
1 a modificat fișierele cu 3 adăugiri și 5 ștergeri
  1. 3 5
      packages/fcl-process/src/dbugintf.pp

+ 3 - 5
packages/fcl-process/src/dbugintf.pp

@@ -68,7 +68,7 @@ var
   DebugClient : TSimpleIPCClient = nil;
   DebugClient : TSimpleIPCClient = nil;
   MsgBuffer : TMemoryStream = Nil;
   MsgBuffer : TMemoryStream = Nil;
   ServerID : Integer;
   ServerID : Integer;
-  DebugDisabled : Boolean;
+  DebugDisabled : Boolean = False;
   Indent : Integer = 0;
   Indent : Integer = 0;
   
   
 Procedure WriteMessage(Const Msg : TDebugMessage);
 Procedure WriteMessage(Const Msg : TDebugMessage);
@@ -236,8 +236,8 @@ begin
       Msg.Msg:=Format(SProcessID,[ApplicationName]);
       Msg.Msg:=Format(SProcessID,[ApplicationName]);
       WriteMessage(Msg);
       WriteMessage(Msg);
       end;
       end;
-    FreeAndNil(MsgBuffer);
-    FreeAndNil(DebugClient);
+    if assigned(MsgBuffer) then FreeAndNil(MsgBuffer);
+    if assigned(DebugClient) then FreeAndNil(DebugClient);
   except
   except
   end;
   end;
 end;
 end;
@@ -278,8 +278,6 @@ begin
   Result := True;
   Result := True;
 end;
 end;
 
 
-Initialization
-  DebugDisabled := False;
 Finalization
 Finalization
   FreeDebugClient;
   FreeDebugClient;
 end.
 end.