I've seen this happen with other component sets because the components as well. The situation triggering this is yet unclear to me, but it is a combination of putting the component on a form and letting the application delete it. It appears, but I'm not quite sure, that finalization of the main form is done AFTER all units are finalized while it used to be the other way round. To circumvent this, I set the global variable to nil and test for it in the appropriate location. So basically, to be on the safe side, ICS should set SslCritSect to 0 when finalizing and test for this value in UnloadSSL.

On 11/05/2013 15:42, John Reid wrote:
We are using the ICS in an application that emails various entities (not
spam). Recently, we ran into an issue where the application would not shut
down properly. On some systems it simply persists and on others it reports
that an error occurred and it needs to close. This is after it has
completed all of its functions. I traced into it and found the Finalization
section of OverbyteICSWSocket was executing before the
TComponent.DestroyComponent. The Finalization section calls
DeleteCriticalSection(SslCritSect). TComponent.DestroyComponent calls the
destructor of all its components. Those destructors ultimately call
UnloadSsl and this method uses EnterCriticalSection(SslCritSect) and
LeaveCriticalSection(SslCritSect), which causes an access violation and
prevents the app from closing.
This problem has only been seen recently; prior versions of this app with
this version of the ICS, the exact same components with the exact same
properties, and only slight modification to the code do not hang like this.
First, is executing the Finalization before calling the component's
destructor the *normal* order? Is there some way to control this order?
Second, has anyone else seen this issue? Is there any way to *fix* this
short of removing the use of the SslCritSect in UnloadSsl?
Thanks in advance for any help.

To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to