如何从对象调用调试访问冲突?

时间:2012-08-15 12:36:46

标签: api delphi debugging soap access-violation

当我调用SOAP API方法时,我收到以下消息:

First chance exception at $74EDB9BC. Exception class EAccessViolation with 
message 'Access violation at address 007004F6 in module 'DB2.exe'. 
Read of address 00000005'. Process DB2.exe (3768)

以下是我从堆栈跟踪中获得的信息:

74EDB9AF 8945C0        mov [epb-$40],eax
74EDB9B2 8D45B0        lea eax,[edp-$50]
74EDB9B5 50            push eax
74EDB9B6 FF155C11ED74  call dword ptr [$74ed115c]
74EDB9BC C9            leave

我对Delphi不太熟悉(只是维护旧程序)。有人能告诉我如何调试这里发生的事情吗?我正在使用Delphi 2005。

这是失败的代码。调用UpdateContact时出现错误,我知道aContact&的数据FCompanyID是正确的:

function TScheduleCenterBeta.AccountUpdate(aContact: c_ScheduleCenterBetaAPI.Contact): boolean;
begin
  try
    SendAuthHeader();
    FContact := FSoapService.UpdateContact(aContact, FCompanyID);
  except
    on e:Exception do begin
      MessageDlg(e.Message,mtWarning,[mbOK],0);
    end;
  end;
  result := true;
end;

创建主对象时创建了对象FContact

constructor TScheduleCenterBeta.Create(aOwner: TComponent; aCallID: integer = -1);
begin
  inherited Create(aOwner);

  FCallID := aCallID;
  FCompanyID := c_ScheduleCenterBetaAPI.CompanyID.Create();
  FCompanyID.ServiceCompanyID := StrToInt(TfrmCall(Screen.ActiveForm).Company.IP_CompanyID);
  FProperty_ := c_ScheduleCenterBetaAPI.Property_.Create();
  FContact := c_ScheduleCenterBetaAPI.Contact.Create();
  FContact.ContactID := -1;
  FContact.Address := c_ScheduleCenterBetaAPI.Address.Create();
  FAppointmentSlot := c_ScheduleCenterBetaAPI.AppointmentSlot.Create();
end;

另一个奇怪的是错误来来去去。如果我停止程序然后再次启动它(使用Delphi调试模式)我可能会或可能不会遇到错误。我还重新启动了Delphi,以确保它不是Delphi本身的东西,但似乎没有改变任何东西。

0 个答案:

没有答案
相关问题