Thanks Bob and Thomas.

I expected that the system will see that the pointer is invalid, but you 
are right: it cannot know that.
Now everything is clear.
Thanks!

Daniel




Thomas W. Clay wrote:
> Try:
>
>       t := nil;
>       t.free();
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of CubicDesign
> Sent: Saturday, July 12, 2008 10:31
> To: Borland's Delphi Discussion List
> Subject: Re: Application will never crash!!!
>
> No, no, no, no, no....  :)
> Sorry... I didn't make myself clear!
>
> I know how to free an object. This is not the point of my email at all.
> I just wanted to create a piece of code that is supposed to crash (AV) 
> the program.
>
> And
>
> var t: tobject;
> begin
>   t.free;
> end;
>
> should do that. Right? Well, in my case it doesn't!! This is my problem! 
> Why the application doesn't crash?????
>
> I will repeat the initial conditions: brand new Delphi, no update, no 
> IDE experts, brand new Windows XP SP2 (with updates) but no other programs.
> Also: if I disable Compiler Optimization, the application works as 
> expected (access violation).
>
> Thanks.
>
>
>
>
> Dean Stow wrote:
>   
>> Before freeing T, you need to have created it.
>>
>> What is likely happening is that the address pointer for the variable T is
>> starting out pointing to a part of memory that if treated as a stringlist
>> and Free is called will close the form but not the application.
>>
>> I would suspect that there is nothing wrong with your computer and nothing
>> wrong with Delphi.  You are just doing something that is unsafe.  You are
>> accessing a method of an uninitialized object.
>>
>> The compiler optimization is bypassing the internal code that checks for
>> such problems and is assuming that the code has been thoroughly debugged
>>     
> and
>   
>> that you know exactly what you are up to.
>>
>> I hope this is helpful.
>>
>> Dean
>>
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
>>     
> Behalf
>   
>> Of CubicDesign
>> Sent: Friday, July 11, 2008 2:19 PM
>> To: undisclosed-recipients:
>> Subject: Application will never crash!!!
>>
>> Hi.
>>
>> Recently I have discovered that my application will not crash if I run 
>> this code with "compiler optimization" turned on.
>>
>> Procedure TForm.buttonclick(sneder: tobject);
>> Var t: tstringlist;
>> Begin
>>   t.free;
>> End;
>>
>> If I push the button that calls this code, the main for disappear but 
>> the application still remains in memory. I have to use Ctrl+Alt+Del to 
>> kill it.
>>
>> I have reinstalled Delphi, but this still didn't fixed my problem. Then 
>> I have reinstalled Windows, and again Delphi, without the Update1 and 
>> without 3^rd part components or IDE experts. Still not working.
>>
>> I don't know what to try else. A new computer? :)
>>
>> _______________________________________________
>> Delphi mailing list -> [email protected]
>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>> Hurley and Associates believes positions are unique to each person's 
>> risk bearing ability, marketing strategy, and crop conditions, 
>> therefore we give no blanket recommendations. The risk of loss 
>> in trading commodities can be substantial, therefore carefully 
>> consider whether such trading is suitable for you in light of 
>> your financial condition. NFA Rules require us to advise you 
>> that past performance is not indicative of future results, and 
>> there is no guarantee that your trading experience will be similar 
>> to past performance.
>>
>> Hurley and Associates believes positions are unique to each person's 
>> risk bearing ability, marketing strategy, and crop conditions, 
>> therefore we give no blanket recommendations. The risk of loss 
>> in trading commodities can be substantial, therefore carefully 
>> consider whether such trading is suitable for you in light of 
>> your financial condition. NFA Rules require us to advise you 
>> that past performance is not indicative of future results, and 
>> there is no guarantee that your trading experience will be similar 
>> to past performance.
>>
>> _______________________________________________
>> Delphi mailing list -> [email protected]
>> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>>
>>   
>>     
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 3263 (20080711) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>  
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 3263 (20080711) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>  
>  
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 3263 (20080711) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>  
>
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>   
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to