> I noticed something.
>
> If in the OnDocData event handler of THttpCli I somehow re-enter the
> "message pump" (that is, do something that calls
> Application.HandleMessage or Application.ProcessMessages) the downloaded
> file is corrupted! It took me a while to find this out and now I'm asking:
>
> (1) What do I do to protect myself from something like this. When
> working with 3rd party components you don't always know what's behind
> the code and 3rd party components might do Application.HandleMessage or
> Application.ProcessMessage without advertising it. Is there something I
> can do so I can raise an error if the code in OnDocData caused an
> dangerous message to be processed?

I don't know of ANY component where it is safe to call the message pump from
one of its event without knowing what happend. Even for a simple
TButton.OnClick, you can get strange result if you call the message pump
within the OnClick handler because the handler is re-entered. The problem is
more visible with TWSocket since it is likely the event is always reentered
because of the high rate network I/O has.

> (2) Are there other such "traps" one needs to be aware of?
> Like not implementing timeout?

Destroying the component from one of its event handlers. Again this is the
same issue as with ANY other component. I don't think there are specific
traps. Of course anything can be a trap if you don't know how things
works...

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be

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

Reply via email to