Re: newbie: deactivate query before freeing?
- From: "Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 11:05:13 +0200
"swansnow" <schultz@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1127950675.863873.233630@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[...]
> In addition you're saying that the following code is ok:
>
> myQuery := nil;
> freeAndNil(myQuery);
>
> But the following code isn't ok?
>
> myQuery := nil;
> myQuery.free;
>
> Do I have it right?
Er, no. Sorry. Free is *always* safe. I think I said that, but I'm too
lazy to go back and check. FreeAndNil adds no magic, just the convenience
of freeing and clearing an object reference in a single statement.
The unsafe one is Destroy, the destructor. Trying to destroy anything
but a valid object reference is an instant access violation.
Groetjes,
Maarten Wiltink
.
- Follow-Ups:
- Re: newbie: deactivate query before freeing?
- From: swansnow
- Re: newbie: deactivate query before freeing?
- References:
- newbie: deactivate query before freeing?
- From: swansnow
- Re: newbie: deactivate query before freeing?
- From: Maarten Wiltink
- Re: newbie: deactivate query before freeing?
- From: swansnow
- newbie: deactivate query before freeing?
- Prev by Date: Re: newbie: deactivate query before freeing?
- Next by Date: Re: newbie: deactivate query before freeing?
- Previous by thread: Re: newbie: deactivate query before freeing?
- Next by thread: Re: newbie: deactivate query before freeing?
- Index(es):
Relevant Pages
|
|