mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-17 05:20:48 +01:00
Dbg: Fix a race condition, nil pointer access
git-svn-id: trunk@32390 -
This commit is contained in:
parent
7e8d161edb
commit
77825e7849
@ -10042,6 +10042,9 @@ end;
|
|||||||
|
|
||||||
procedure TGDBMIDebuggerCommandEvaluate.DoWatchFreed(Sender: TObject);
|
procedure TGDBMIDebuggerCommandEvaluate.DoWatchFreed(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF DBGMI_QUEUE_DEBUG}
|
||||||
|
debugln(['DoWatchFreed: ', DebugText]);
|
||||||
|
{$ENDIF}
|
||||||
FWatchValue := nil;
|
FWatchValue := nil;
|
||||||
Cancel;
|
Cancel;
|
||||||
end;
|
end;
|
||||||
@ -11233,24 +11236,27 @@ end;
|
|||||||
function TGDBMIDebuggerCommandEvaluate.SelectContext: Boolean;
|
function TGDBMIDebuggerCommandEvaluate.SelectContext: Boolean;
|
||||||
var
|
var
|
||||||
R: TGDBMIExecResult;
|
R: TGDBMIExecResult;
|
||||||
|
t, f: Integer;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
FThreadChanged := False;
|
FThreadChanged := False;
|
||||||
FStackFrameChanged := False;
|
FStackFrameChanged := False;
|
||||||
if FWatchValue = nil then exit;
|
if FWatchValue = nil then exit;
|
||||||
|
t := FWatchValue.ThreadId;
|
||||||
|
f := FWatchValue.StackFrame;
|
||||||
|
|
||||||
if FWatchValue.ThreadId <> FTheDebugger.FCurrentThreadId then begin
|
if t <> FTheDebugger.FCurrentThreadId then begin
|
||||||
FThreadChanged := True;
|
FThreadChanged := True;
|
||||||
Result := ExecuteCommand('-thread-select %d', [FWatchValue.ThreadId], R);
|
Result := ExecuteCommand('-thread-select %d', [t], R);
|
||||||
FTheDebugger.FInternalThreadId := FWatchValue.ThreadId;
|
FTheDebugger.FInternalThreadId := t;
|
||||||
Result := Result and (R.State <> dsError);
|
Result := Result and (R.State <> dsError);
|
||||||
end;
|
end;
|
||||||
if not Result then exit;
|
if not Result then exit;
|
||||||
|
|
||||||
if (FWatchValue.StackFrame <> FTheDebugger.FCurrentStackFrame) or FThreadChanged then begin
|
if (f <> FTheDebugger.FCurrentStackFrame) or FThreadChanged then begin
|
||||||
FStackFrameChanged := True;
|
FStackFrameChanged := True;
|
||||||
Result := ExecuteCommand('-stack-select-frame %d', [FWatchValue.StackFrame], R);
|
Result := ExecuteCommand('-stack-select-frame %d', [f], R);
|
||||||
FTheDebugger.FInternalStackFrame := FWatchValue.StackFrame;
|
FTheDebugger.FInternalStackFrame := f;
|
||||||
Result := Result and (R.State <> dsError);
|
Result := Result and (R.State <> dsError);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user