Have a problem with invalid pointer to object's method in Destroy. Does anybody have any idea why? Here is the code snippet:
TThreadSafeParametersList = class(TThreadList)
destructor Destroy; override;
self.Duplicates := dupAccept;
FreeAllAndClearList; ////<= from time-to-time AV is caused by pointer to this method no longer is valid (000000)
with LockList do try
for i := 0 to Count-1 do try
if Assigned(TObject(Items[i])) then TObject(Items[i]).Free;
Somewhere in MainForm:
Parameters := TThreadSafeParametersList.
... Do something with Parameters in several working threads.
... All threads gets closed.
... In MainForm (OnCloseQuery) I wanted to clean things up but ...
FreeAndNil(Parameters); //<= this is where frome time-to-time I get an AV 000000 at address 000000