Access Violation when i drop a TidSMTP on a Form

。_饼干妹妹 提交于 2019-12-11 06:54:41

问题


i've a problem with Delphi XE4: when i drop on a form an TIdSmtp or TIsSSLIOHandlerSocketOpenSSL i receive this error:

[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

Anyone can help me?

With other components like IdUserPassProvider or IdSASLPlain work fine.

Regards


回答1:


It is hard to diagnose your problem without seeing the actual error message. Is it an actual EAccessViolation exception, or is it a different type of exception? Just because an exception is raised does not guarantee it is actually an EAccessViolation unless it really is an Access Violation.

TIdStack.IncUsage() ensures that Indy's global GStack object exists. That object is what provides access to all of the low-level platform-specific socket API functions used throughout Idny. IncUsage() itself is a class method, so it is not called on a TIdStack object instance, so merely calling IncUsage() itself is not the cause of the exception.

Internally, IncUsage() uses three global variables in the IdStack unit:

GStackCriticalSection: TIdCriticalSection
GInstanceCount: LongWord
GStackClass: TIdStackClass

All three variables are initialized to 0/nil in their respective declarations, and then GStackClass and GStackCriticalSection are assigned/constructed in the initialization section of the IdStack unit.

An exception can only occur if one of those variables is invalid at the time IncUsage() is called (unless the exception is coming from a TIdStack constructor, but I do not see that in your call stack).

Perhaps something in your project is preventing the initialization from being called, causing IncUsage() to crash when it tries to enter the GStackCriticalSection lock (but I do not see TIdCriticalSection.Enter in your call stack)? There is an Assert() to make sure GStackCriticalSection is not nil before it is used, but maybe your copy of Indy was compiled with asserts disabled?




回答2:


thanks for the support, I solved the problem but I have not yet understood why.

the problem is in the Design package; I attach the differences between the dproj that working and the dproj with the error.

I still have not figured out if it depends on a single package or more, anyway, enabling all packages work correctly.

Thanks again, I go back to replicate if i find the package that generates the error.



来源:https://stackoverflow.com/questions/21958575/access-violation-when-i-drop-a-tidsmtp-on-a-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!