[fpc-pascal] Re: Fpc Access Violation if AppConfigDir doesn't exist.
nc-gaertnma at netcologne.de
Tue Feb 12 13:58:45 CET 2013
Giuliano Colla <giuliano.colla at fastwebnet.it> hat am 12. Februar 2013 um 13:29
> Why FormClose doesn't close the form in presence of an error (handled by
> a try..finally) when writing the ini file?
> Launching from command line, you have the same behavior, and an
> additional information when you select Cancel:
> WARNING: TLCLComponent.Destroy with LCLRefCount>0. Hint: Maybe the component
> is processing an event?
> Try..except situation, from IDE and Debugger.
> Press the Close button. Debugger Notification. Pressing Continue my
> message dialog is shown. Pressing OK on my dialog the form is closed and
> the program is terminated.
> Launching from command line, no console messages.
> My conclusion is that one can't properly handle INI files with just a
> try..finally construct, as all examples show, because a possible error
> will propagate outside the construct, with unpredictable effects (in
> this case the FormClose procedure doesn't properly complete).
The LCL has a default exception handler, so that the application notifies the
user, that the application has a bug instead of simply crashing and vanishing
The programmr is reponsible to handle exceptions, show the user error messages
and give the user choices (e.g. ignore, retry).
BTW, the Ini.Free writes to disk, so it needs the try..except, the WriteValue
calls do not need the try..except.
More information about the fpc-pascal