Delphi 在表单上删除TidSMTP时发生访问冲突

Delphi 在表单上删除TidSMTP时发生访问冲突,delphi,indy,access-violation,delphi-xe4,Delphi,Indy,Access Violation,Delphi Xe4,我对Delphi XE4有一个问题:当我在表单上放置一个TIdSmtp或TIsSSLIOHandlerSocketOpenSSL时,我收到以下错误: [511EDABF]{IndySystem180.bpl} IdStack.TIdStack.IncUsage (Line 688, "IdStack.pas" + 11) + $7 [511EEBB2]{IndySystem180.bpl} IdComponent.TIdComponent.InitComponent (Line 229, "Id

我对Delphi XE4有一个问题:当我在表单上放置一个TIdSmtp或TIsSSLIOHandlerSocketOpenSSL时,我收到以下错误:

[511EDABF]{IndySystem180.bpl} IdStack.TIdStack.IncUsage (Line 688, "IdStack.pas" + 11) + $7
[511EEBB2]{IndySystem180.bpl} IdComponent.TIdComponent.InitComponent (Line 229, "IdComponent.pas" + 1) + $5
[50EE84A2]{IndyCore180.bpl} IdTCPConnection.TIdTCPConnection.InitComponent (Line 912, "IdTCPConnection.pas" + 1) + $2
[50EE0D99]{IndyCore180.bpl} IdTCPClient.TIdTCPClientCustom.InitComponent (Line 256, "IdTCPClient.pas" + 1) + $2
[50FC53D5]{IndyProtocols180.bpl} IdExplicitTLSClientServerBase.TIdExplicitTLSClient.InitComponent (Line 262, "IdExplicitTLSClientServerBase.pas" + 1) + $2
[50FC8E5D]{IndyProtocols180.bpl} IdMessageClient.TIdMessageClient.InitComponent (Line 643, "IdMessageClient.pas" + 1) + $2
[510B9AF9]{IndyProtocols180.bpl} IdSMTPBase.TIdSMTPBase.InitComponent (Line 193, "IdSMTPBase.pas" + 1) + $2
[510BB47D]{IndyProtocols180.bpl} IdSMTP.TIdSMTP.InitComponent (Line 383, "IdSMTP.pas" + 1) + $2
[511CF547]{IndySystem180.bpl} IdBaseComponent.TIdInitializerComponent.Create (Line 186, "IdBaseComponent.pas" + 4) + $4
[21D64B2B]{delphicoreide180.bpl} CompPalMgr.TComponentPalettePageItemDelegate.CreateComponent (Line 2756, "CompPalMgr.pas" + 2) + $7
[2113FFAB]{designide180.bpl} ComponentDesigner.TComponentRoot.DoCreateComponent (Line 2359, "ComponentDesigner.pas" + 12) + $17
[21145796]{designide180.bpl} ComponentDesigner.TComponentRoot.CreateCurrentComponent (Line 4450, "ComponentDesigner.pas" + 2) + $32
[2115DBAA]{designide180.bpl} Surface.TDesignSurface.CreateItem (Line 195, "Surface.pas" + 1) + $11
[2111193A]{designide180.bpl} Designer.TDesigner.DoDragCreate (Line 794, "Designer.pas" + 1) + $F
[211121E8]{designide180.bpl} Designer.TDesigner.DragEnd (Line 974, "Designer.pas" + 19) + $3
[21114880]{designide180.bpl} Designer.TDesigner.MouseUp (Line 1763, "Designer.pas" + 1) + $2
[51FEEE82]{vcldesigner180.bpl} VCLSurface.MouseEvent (Line 3187, "VCLSurface.pas" + 45) + $11
[5005F7EB]{rtl180.bpl  } System.TMonitor.Exit (Line 16933, "System.pas" + 2) + $7
[51FEFA6F]{vcldesigner180.bpl} VCLSurface.TVclDesignSurface.IsDesignMsg (Line 3448, "VCLSurface.pas" + 48) + $6
[50582B07]{vcl180.bpl  } Vcl.Forms.TApplication.DispatchAction (Line 11494, "Vcl.Forms.pas" + 9) + $C
[0B6A7E30]{IDEFixPack.dll} VCLDesignerGuideLinesHideFix.IsDesignMsg + $94
[5045287F]{vcl180.bpl  } Vcl.Controls.TControl.WndProc (Line 7137, "Vcl.Controls.pas" + 4) + $21
[50170090]{rtl180.bpl  } System.Classes.StdWndProc (Line 16860, "System.Classes.pas" + 8) + $0
[50456DEB]{vcl180.bpl  } Vcl.Controls.TWinControl.IsControlMouseMsg (Line 9807, "Vcl.Controls.pas" + 1) + $9
[504575B5]{vcl180.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10039, "Vcl.Controls.pas" + 153) + $6
[505777F9]{vcl180.bpl  } Vcl.Forms.TCustomForm.WndProc (Line 4388, "Vcl.Forms.pas" + 201) + $5
[51FF84BF]{vcldesigner180.bpl} VCLFormContainer.TControlSizer.ControlWndProc (Line 311, "VCLFormContainer.pas" + 33) + $C
[50456BF8]{vcl180.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 9751, "Vcl.Controls.pas" + 3) + $6
[50170090]{rtl180.bpl  } System.Classes.StdWndProc (Line 16860, "System.Classes.pas" + 8) + $0
[50582213]{vcl180.bpl  } Vcl.Forms.TApplication.CancelHint (Line 11117, "Vcl.Forms.pas" + 6) + $E
[50580E87]{vcl180.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 10288, "Vcl.Forms.pas" + 23) + $1
[50580ECA]{vcl180.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 10318, "Vcl.Forms.pas" + 1) + $4
[50581205]{vcl180.bpl  } Vcl.Forms.TApplication.Run (Line 10456, "Vcl.Forms.pas" + 26) + $3
有人能帮我吗

与其他组件(如IdUserPassProvider或IdSASLPlain)配合使用,效果良好


关于

如果不看到实际的错误消息,就很难诊断您的问题。它是实际的
eaccessinvalition
异常,还是不同类型的异常?仅仅因为引发了异常,并不保证它实际上是一个
eaccess违规
,除非它确实是一个访问违规

TIdStack.IncUsage()
确保Indy的全局
GStack
对象存在。该对象提供了对Idny中使用的所有底层特定于平台的socket API函数的访问
IncUsage()
本身是一个
class
方法,因此不会在
TIdStack
对象实例上调用它,因此仅调用
IncUsage()
本身并不是异常的原因

在内部,
IncUsage()
IdStack
单元中使用三个全局变量:

GStackCriticalSection: TIdCriticalSection
GInstanceCount: LongWord
GStackClass: TIdStackClass
所有三个变量在各自的声明中初始化为
0
/
nil
,然后
GStackClass
GStackCriticalSection
IdStack
单元的
初始化
部分分配/构造

只有在调用
IncUsage()
时其中一个变量无效时才会发生异常(除非异常来自
TIdStack
构造函数,但我在调用堆栈中没有看到)

也许您的项目中有什么东西阻止调用
初始化
,导致
IncUsage()
在尝试进入
GStackCriticalSection
锁时崩溃(但我没有看到
tidccriticalsection.enter
在您的调用堆栈中)?有一个
Assert()
来确保
GStackCriticalSection
在使用之前不是
nil
,但是您的Indy副本可能是在禁用Assert的情况下编译的?

感谢您的支持, 我解决了这个问题,但我还不明白为什么

问题在设计包中;我附上正在工作的dproj和带有错误的dproj之间的差异

我仍然没有弄清楚它是否依赖于一个或多个包,无论如何,使所有包都能正常工作

再次感谢, 如果找到生成错误的包,我将返回复制


如果您创建一个新的空VCL表单应用程序并将组件放在新的空表单上,是否会发生这种情况?这是一个非常奇怪的问题,我的直觉让我相信可能已经对Indy library进行了一些定制?也就是说,如果肯提出的测试也失败了。否则,如果一个新的应用程序没有引起任何问题,那么责任就指向正在使用它的特定项目。或者可能是Indy升级/降级失败?看起来像Indy缺陷。指定版本号(Delphi和Indy)将非常有用。升级到最新的Indy可能会有帮助。@KenWhite:是的,我对一个新项目也有同样的问题。我怀疑我禁用的某些程序包导致了此错误。我正在调查完整的错误消息是:模块'IndySystem180.bpl'中地址511EDABF的访问冲突。读取地址14D04428。错误消息为:模块“IndySystem210.bpl”中地址512FF2AF处的访问冲突。阅读地址14144508。删除Dproj文件并让Delphi重新生成它将解决问题。您的解决方案有效。删除旧的Dproj文件,让Delphi重新创建它(这意味着bug不是在Indy中而是在Delphi中)。