Am 24.09.2013 11:53, schrieb Xiangrong Fang:

    But it's not a good idea as you'd still need to convert Data to a
    TObject (e.g. by using a cast), but that will fail if Data is
    something else than a pointer-like type...

This worked in my TTree class (destructor):

  if PTypeInfo(TypeInfo(Data))^.Kind = tkObject then TObject(Data).Free;

I don't know in what case it will fail? I tested with a TStringTree, could you please give an example that it will fail?
Try something that is not a Pointer, e.g. a Shortstring, a record, or an ordinal datatype like QWord.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to