Delphi XE5在应用程序启动时加速违规



在两台计算机上可以,在三台计算机上有相同的例外,AV的地址相同。感谢的帮助

begin
  Application.Hinthidepause := 30000;
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.CreateForm(TForm4, Form4);
  Application.Run;
end;

exception class    : EAccessViolation
exception message  : Access violation at address 00405361 in module 'Project1.exe'. Read of address 00000064.
main thread ($1d44):
00405361 +3d Project1.exe System         75  +0 SysGetMem
00406827 +3f Project1.exe System         75  +0 @ReallocMem
0040c38c +d8 Project1.exe System         75  +0 DynArraySetLength
0040c4bd +05 Project1.exe System         75  +0 @DynArraySetLength
005465af +23 Project1.exe System.Classes        {System.Generics.Collections}TList<System.Generics.Collections.TList<System.Classes.TComponent>>.SetCapacity
005466b0 +2c Project1.exe System.Classes        {System.Generics.Collections}TList<System.Generics.Collections.TList<System.Classes.TComponent>>.Grow
005466d2 +16 Project1.exe System.Classes        {System.Generics.Collections}TList<System.Generics.Collections.TList<System.Classes.TComponent>>.GrowCheck
00546a4d +0d Project1.exe System.Classes        {System.Generics.Collections}TList<System.Generics.Collections.TList<System.Classes.TComponent>>.Add
0051e75e +36 Project1.exe System.Classes        BeginGlobalLoading
0051e8de +46 Project1.exe System.Classes        InitInheritedComponent
0064cfde +c6 Project1.exe Vcl.Forms             TCustomForm.Create
00657ffa +76 Project1.exe Vcl.Forms             TApplication.CreateForm
00883ce7 +c7 Project1.exe Project1  54 +13 initialization
76a13368 +10 kernel32.dll 

更新此程序存在问题:

procedure KopiujRTF(const Source, destination: TRichEdit);
var
  rtfStream: TEditStream;
  sourceStream: TMemoryStream;
  function EditStreamReader(dwCookie: DWORD; pBuff: Pointer; cb: LongInt;
    pcb: PLongInt): DWORD; stdcall;
  begin
    Result := $0000;
    try
      pcb^ := TStream(dwCookie).Read(pBuff^, cb);
    except
      Result := $FFFF;
    end;
  end;
begin
  destination.Lines.BeginUpdate;
  sourceStream := TMemoryStream.Create;
  try
    Source.Lines.SaveToStream(sourceStream);
    sourceStream.Position := 0;
    destination.MaxLength := destination.MaxLength + sourceStream.Size;
    rtfStream.dwCookie := DWORD(sourceStream);
    rtfStream.dwError := $0000;
    rtfStream.pfnCallback := @EditStreamReader;
    destination.Perform(EM_STREAMIN, SFF_SELECTION or SF_RTF or SFF_PLAINRTF,
      lParam(@rtfStream));
    if rtfStream.dwError <> $0000 then
      zolty := True;
    sourceStream.Free;
    destination.Lines.EndUpdate;
  except
  end;
end;

在form1创建我有:

RichEdit1.MaxLength:=$7FFFFFF0;

启用范围检查调试器后,高亮显示了以下内容:

destination.MaxLength := destination.MaxLength + sourceStream.Size;

删除RichEdit的最大长度已解决问题。谢谢你的帮助。

调用堆栈表示您已经损坏了程序其他部分的堆。这就是SysGetMem中访问违规的解释,概率>0.999。

在执行此调用堆栈中的代码之前,您需要了解启动期间发生的情况。查找缓冲区溢出,即访问越界的数组元素。很可能,仅仅启用不可或缺的范围检查功能就足以定位程序的缺陷。

我遇到了同样的问题,我发现问题出现在版本的定义中。当我打开版本信息时,我发现该版本未包含,我无法包含它。解决方案是重新创建结构的配置。

相关内容

  • 没有找到相关文章

最新更新