[fpc-devel] patch to call DoneKeyboard in the exitproc of the drivers unit
Daniël Mantione
daniel.mantione at freepascal.org
Sun Aug 16 15:29:30 CEST 2009
Op Sun, 16 Aug 2009, schreef Nikolay Nikolov:
> On 08/16/2009 03:22 PM, Daniël Mantione wrote:
>>
>>
>> Op Sun, 16 Aug 2009, schreef Jonas Maebe:
>>
>>>
>>> On 16 Aug 2009, at 12:15, Nikolay Nikolov wrote:
>>>
>>>> Does anyone have an idea why the call to DoneKeyboard was previously
>>>> commented? It leaves the keyboard in a bad state if the IDE crashes.
>>>
>>> It was changed in revision 3443, whose log message says:
>>>
>>> r3443 | daniel | 2006-05-07 00:57:20 +0200 (Sun, 07 May 2006) | 3 lines
>>> Changed paths:
>>> M /trunk/fv/app.pas
>>> M /trunk/fv/drivers.pas
>>> M /trunk/fv/validate.pas
>>> M /trunk/ide/fp.pas
>>> M /trunk/ide/fpide.pas
>>>
>>> * Video and keyboard initialization spaghetti organized and hopefully
>>> fixed.
>>> - Remove useless function from validate.pas
>>>
>>> Maybe Daniel knows.
>>
>> In Turbo Vision, it is the task of Tapplication to initialize drivers and
>> the task of Tprogram to detect how it was initialized. This was totally
>> messed up; i.e. Tprogram.initscreen is supposed to detect the current
>> screen, but people had inserted code into it that did change the screen, so
>> they also invented a donescreen. This caused a lot of bugs inside FV
>> applications.
>>
>> With this patch, I brought things back as they should be, all
>> intialization/finalization back to Tapplication and Tprogram just detects
>> how things are initialized.
> This is all cool, but IMHO DoneKeyboard should also be called in the ExitProc
> to clean things up in case a runtime error occurs, since then the
> TApplication destructor isn't (usually) called. Is there a reason not to do
> that? Calling DoneKeyboard twice on normal exit should be safe, as it checks
> a flag and does nothing when you call it the second time.
I can see the issue with abnormal program exits, but I disabled it
because calling it twice had unintended effects. So we need to verify we
don't break anything.
Daniël
More information about the fpc-devel
mailing list