Re: newbie: deactivate query before freeing?



"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


.



Relevant Pages

  • Re: Sun one WS : clean shutdown
    ... I am not saying that. ... I implemented destroy() in my own application servlets, ... And I cant get any help from SUN docs about how the orderly ...
    (comp.lang.java.programmer)
  • Re: OT - The Berger File: Sandy Berger didnt destroy documents with notes in the margin.
    ... Why do you keep saying this? ... Hillman, who assured us that Mr. Berger did not deny any documents to ... 'There is no evidence that he did destroy originals. ...
    (alt.guitar.amps)
  • Re: Scientific Proof of the Great Flood
    ... Genesis is saying that the natural phenomenon was created by God as a ... sign that He would not destroy by flood ever again. ...
    (talk.origins)
  • Re: Adam, What Is Going On?
    ... As the old saying goes, it takes a long time to build a reputation ... and a fraction of that to destroy it. ...
    (soc.culture.scottish)
  • Re: Problems with HTTP_REFERER
    ... All it's saying is that there is no value for the HTTP_Referer item, ... means that the array item will be a null value. ... string for that matter. ... > Object reference not set to an instance of an object. ...
    (microsoft.public.dotnet.framework.aspnet)