TIP: Click on subject to list as thread! ANSI
echo: delphi
to: MARTIN MAAT
from: BRYAN SMITH
date: 1997-05-06 13:24:00
subject: Need insight into object behaviour.

On 03 May 97 Martin Maat said to Bryan Smith...
 MM> You know too much and you know too little. That's where trouble starts
Like the old saying, "We get too soon old and too late smart" !
 MM> So much you seemed to understand. So, what really happened was that
 MM> your BodyFont was really the same instance as the font dialog's font
 MM> property. This could still be fine, BUT YOU MUST NOT DESTROY THAT
 MM> INSTANCE! When your program terminates, all objects are destroyed,
 MM> meaning all Destroy methods of all objects are called. The font dialog
 MM> will clean up it's internals, including it's font property. By the
 MM> time it calls the Destroy or Free method of that font property, there
 MM> will no font property anymore because YOU destroyed it earlier!
===> GPF
I've seen advice that whenever you destroy anything yourself, you should
immediately set the pointer to nul. Does that solve this problem ?
 MM> A similar problem arises when we want to "clean up" components we
 MM> created. A component's Create method takes one parameter, being the
 MM> owner of the created component. Being the neat nerts that we are, we
 MM> tend to clean up everything we created. However, every component tries
 MM> to clean up everything it owns when it is destroyed. ===> GPF   When
 MM> you provide an existing component as the owner parameter on the
 MM> creation of a component, you must leave the initiative to destroy the
 MM> component to it's owner.
That's new to me - thanks for the insight.
--- PPoint 2.00
---------------
* Origin: Kingston, Canada (1:249/109.11)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.