[Lazarus] Invalid type cast in DBActns

silvioprog silvioprog at gmail.com
Tue Oct 5 20:54:28 CEST 2010


En/na Marcos Douglas ha escrit:
> On Tue, Oct 5, 2010 at 9:40 AM, Luca Olivetti <luca at wetron.es> wrote:
>> En/na silvioprog ha escrit:
>>> Hi folks,
>>>
>>> I detected a small leak in the TThread class. I made a simple test and I
>>> sending in attached (or http://pastebin.com/aWNuHyDQ). To reproduce the
>>> leak, just open and close the demo.
>> That's probably because the thread has no chance to run (you create it
>> suspended and never resume it).
>> If you create it with suspended=false or resume it right after creating it,
>> there's no leak.
> 
> Even that, I consider this a bug, don't you?

I'm not sure it is: when I create a thread is because I need it to run, 
if it doesn't have to run I simply don't create it.
In the constructor I usually delay starting  the thread until all 
members are correctly initialized (i.e. "inherited create(true); 
foo:=Tfoo.create; resume"), but afterwards it has to run.
If you forget to, say, free objects in a thread, it will cause a memory 
leak but it's not a bug, this case is analogous: you create a thread but 
forget to start it.

Bye
-- 
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004 (Ext.133)  Fax +34 93 5883007




More information about the Lazarus mailing list