我正在处理具有两个列表框的应用程序。我用值加载了两个列表框,当我继续单击列表框中的项目时,调试时出现以下错误。
运行 exe 会导致应用程序关闭。有时我会收到“访问冲突”消息。
那么我应该怎么做才能从我的应用程序中摆脱这个错误呢?
编辑
..
主窗体具有刷新所有控件 timer_RefreshCONtrol (intervali 1) 的计时器。
每当修改editBox_one(值)时,都会调用此函数
Procedure TStringSetting.SetValue (const AValue : String);
Begin
...
If FValueControl <> Nil then
Begin
FValueControl.OnChange := VoidNotifyEvent;
FValueControl.Text := NewValue;
FValueControl.OnChange := EditChange; //<--here the stackoverflow error comes....
end;
end;
Procedure EditChange (Sender: TObject);
Begin
Value := FValueControl.Text;
If Not EditIsValid then FValueControl.Font.Color := clRed
else If Dirty then FValueControl.Font.Color := clBlue
else FValueControl.Font.Color := clWindowText;
If @OldCustomEditChange <> Nil then OldCustomEditChange(Sender);
end;`
the EditChange (Sender: TObject); <--keeps geting called and the stackoverflow error comes
EditChange
分配给编辑框FormCreate
编辑2
我不是最初的开发人员。我有时只是处理代码,不可能进行重大重构。
编辑 3
调用堆栈值,但什么是“???”
编辑 4
经过@Cosmin Prund 和@david
我找到了无限通话开始的地方
Procedure TFloatSetting.EditChange (Sender: TObject);
Begin
SkipNextOnChange := True;
Inherited EditChange(Sender);
IfValidThenStore(FValueControl.Text);
Inherited EditChange(Sender); {<-------This is where it start}
end;
Procedure TStringSetting.EditChange (Sender: TObject);
Begin
Value := FValueControl.Text;
If Not EditIsValid then FValueControl.Font.Color := clRed
else If Dirty then FValueControl.Font.Color := clBlue
else FValueControl.Font.Color := clWindowText;
If @OldCustomEditChange <> Nil then OldCustomEditChange(Sender); {<---this keeps calling Procedure TFloatSetting.EditChange (Sender: TObject);}
end;