View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0024134 | Lazarus | Database Components | public | 2013-03-25 13:53 | 2013-03-29 22:01 |
Reporter | Daniel Simões de Almeida | Assigned To | Bart Broersma | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Windows | OS | Seven | ||
Product Version | 1.1 (SVN) | ||||
Fixed in Version | 1.1 (SVN) | ||||
Summary | 0024134: TDBedit maskedit verification on Exit, crashes the Application | ||||
Description | When TDBedit has a MaskEdit, the application crashes when exiting TDBedit after the Invalid Mask message is showed... Lazarus 1.1 from SVN FPC: 2.7.1 from 2013-03-20 | ||||
Steps To Reproduce | The attached project application can demonstrate how to reproduce the problem | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r40660 | ||||
LazTarget | - | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
|
|
|
maskedit.pp.patch (1,085 bytes)
Index: maskedit.pp =================================================================== --- maskedit.pp (revision 40640) +++ maskedit.pp (working copy) @@ -1615,14 +1615,16 @@ {$IFNDEF MASKEDIT_NOVALIDATEONEXIT} //Do not validate if FValidationFailed, or risk raising an exception while the previous exception was //not handled, resulting in an application crash - if IsMasked and (FTextOnEnter <> Inherited Text) and (not FValidationFailed) then + if IsMasked and (FTextOnEnter <> Inherited Text) then begin //assume failure try //debugln('TCustomMaskedit.DoExit: try ValidateEdit'); - FValidationFailed := True; - ValidateEdit; - FValidationFailed := False; + if (not FValidationFailed) then + begin + ValidateEdit; + FValidationFailed := False; + end ; finally if FValidationFailed then begin @@ -1967,6 +1969,7 @@ if not TextIsValid(S) then begin SetCursorPos; + FValidationFailed := True; Raise EDBEditError.Create(SMaskEditNoMatch); end; end; |
|
I attached a suggestion for a Patch |
|
I'm unclear how this patch would solve it? The logic behind the original code was to never call ValidateEdit if FValidationFailed = True. Since ValidateEdit is the only place where the exception is raised. Your patch (maybe I'm wrong?) does the same but in a diferent place. Mind you that FValidationFailed will remain True in the original code if validation fails, because this will raise an exception and the next statement (FValidationFailed := False; ) will never be executed. In your sample program please verify that in the originalmaskedit code FValidationFailed is False when ValidateEdit is called (insert a debugln at the appropriate place). I cannot test, since I have no database components installed on any of my machines. |
|
Hi Bart, Thanks for answering... The problem is that the procedure TDBEdit.UpdateData do a direct call to TCustomMaskEdit.ValidateEdit... and this cause a EDBEditError.Create(SMaskEditNoMatch)... this exception will be triggers again during the TCustomMaskEdit.DoExit, and this causes the Application crash Moving the FValidationFailed = True to inside the procedure TCustomMaskEdit.ValidateEdit can prevent the Second Exception to be raised. |
|
Thanks for the analysis and the patch. Applied in r40660. Please test and close if OK. |
|
Fixed... Thank you |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-03-25 13:53 | Daniel Simões de Almeida | New Issue | |
2013-03-25 13:55 | Daniel Simões de Almeida | File Added: TDBEdit_with_maskedit.zip | |
2013-03-25 16:57 | Daniel Simões de Almeida | File Added: maskedit.pp.patch | |
2013-03-25 16:58 | Daniel Simões de Almeida | Note Added: 0066554 | |
2013-03-28 14:26 | Bart Broersma | Note Added: 0066604 | |
2013-03-28 16:00 | Daniel Simões de Almeida | Note Added: 0066605 | |
2013-03-28 18:53 | Bart Broersma | Fixed in Revision | => r40660 |
2013-03-28 18:53 | Bart Broersma | LazTarget | => - |
2013-03-28 18:53 | Bart Broersma | Note Added: 0066609 | |
2013-03-28 18:53 | Bart Broersma | Status | new => resolved |
2013-03-28 18:53 | Bart Broersma | Fixed in Version | => 1.1 (SVN) |
2013-03-28 18:53 | Bart Broersma | Resolution | open => fixed |
2013-03-28 18:53 | Bart Broersma | Assigned To | => Bart Broersma |
2013-03-29 22:01 | Daniel Simões de Almeida | Note Added: 0066628 | |
2013-03-29 22:01 | Daniel Simões de Almeida | Status | resolved => closed |