Hello Bryan,
BS> I've seen advice that whenever you destroy anything yourself, you
BS> should immediately set the pointer to nul. Does that solve this
BS> problem ?
This is just good practice which enables you to check on an object's value
and know if it exists or not:
if Assigned(Object) then
it exists and you can do something with it
else
it doesn't and you may want to create it before you proceed
or do nothing at all
That is, you can check for the objects _you_ are responsible for. You should
not be bothered with either cleaning up or creating objects encapsulated
within other objects and you should not try to get involved. This is mainly
what OOP is all about.
It wouldn't take you longer than 1 minute to find out whether the font dialog
checks for a nil value before destroying it's font property. (if it does,
your effort to destroy it will still be no good bad practice but won't cause
errors, if it doesn't you'll get the error just the same)
Usually things don't work that way and they should not either. The font
dialog cannot prevent others doing nasty things with it's object properties
(well meant or not). It is itself responsible for creating the font object,
so it will be available to users like you, and it will clean it up too when
it's no longer needed. It would be almost indecent to interfere :-).
Groeten, Martin.
--- FMail/386 1.02
---------------
* Origin: -=[ E-mail: m_maat@knoware.nl .......... ]=- (2:286/420.1)
|