Coding > FPC Valkyrie

"Destroy" method override in Vnode?..

(1/5) > >>

Igor Savin:
       destructor  Destroy; override;

...even though it consecutively inherits from TVClass and TVObject, neither of which has defined destructor.


Kornel Kisielewicz:
TObject, the base class of all objects in FreePascal has a Destroy method (note that you can call X.Destroy on ANY object in FreePascal, even if it doesn;t define it's own destructor). The usage of it is for data structures -- so they can hold any sets of objects, and be sure that if they call Object.Destroy, then all data will be properly disposed of.

P.S. What's up lately? :)

Igor Savin:
Aha, I see it now. God damn the FreePascal documentation for omitting heaps of useful information and being an overall mess.

A second question: I somehow managed to get program crashing with calling the TNode.Free procedure, for which I cannot find any description and which doesn't look like a simple Destructor. What is is, where it comes from and what it really does? Is it safe to replace it with merely a TNode.Destroy (which doesn't produce any crashes) or there's a catch?

Awww... lots of stuff. I'm almost ready taking on the Universe with limited public release of "HoaH", which now mostly requires some polish (functionality-wise it only lacks some easier-to-implement stuff which isn't really necessary to prove geniality of the concept).

In regards to Life (TM): I've got my first serious work (software tester at one of the largest Lithuanian IT companies), I have an uncoming session on me, and this Spring I'm getting engaged (-:. Life's bright, life's taxing. Life is good.

p. s. My avatar seems outdated in regards to yours :).

Kornel Kisielewicz:
A good programming practice is to never use Free or Destroy at all, but to always use FreeAndNil(Object) -- from SysUtils. It's the safest way (if the object is already nil, then nothing happens).

As to real life -- OMG! O.o

Igor Savin:
Kornel, shouldn't TNode.Detach include Parent:=nil?..


[0] Message Index

[#] Next page

Go to full version