* Fix Access Violation when starting debug server failed

This commit is contained in:
Michaël Van Canneyt 2023-10-11 08:47:36 +02:00
parent 94cb1c3a49
commit 26e66fda75

View File

@ -118,6 +118,8 @@ var
Procedure WriteMessage(Const Msg : TDebugMessage); Procedure WriteMessage(Const Msg : TDebugMessage);
begin begin
if not Assigned(MsgBuffer) then
exit;
MsgBuffer.Seek(0,soFrombeginning); MsgBuffer.Seek(0,soFrombeginning);
WriteDebugMessageToStream(MsgBuffer,Msg); WriteDebugMessageToStream(MsgBuffer,Msg);
DebugClient.SendMessage(mtUnknown,MsgBuffer); DebugClient.SendMessage(mtUnknown,MsgBuffer);
@ -343,6 +345,7 @@ begin
AlwaysDisplayPID:= ShowPID; AlwaysDisplayPID:= ShowPID;
DebugClient:=TSimpleIPCClient.Create(Nil); DebugClient:=TSimpleIPCClient.Create(Nil);
DebugClient.ServerID:=DebugServerID; DebugClient.ServerID:=DebugServerID;
try
If not DebugClient.ServerRunning then If not DebugClient.ServerRunning then
begin begin
ServerID:=StartDebugServer(ADebugServerExe,ARaiseExceptionOnSendError,ServerLogFileName); ServerID:=StartDebugServer(ADebugServerExe,ARaiseExceptionOnSendError,ServerLogFileName);
@ -361,7 +364,6 @@ begin
Sleep(100); Sleep(100);
end; end;
end; end;
try
DebugClient.Connect; DebugClient.Connect;
except except
FreeAndNil(DebugClient); FreeAndNil(DebugClient);