mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 09:39:09 +02:00
MaskEdit: fix program crash in OnExit of DBEdit, after TDBEdit.UpdateData calls ValidateEdit (issue #0024134).
git-svn-id: trunk@40660 -
This commit is contained in:
parent
c92f53e178
commit
dd4612a337
@ -1615,14 +1615,16 @@ begin
|
|||||||
{$IFNDEF MASKEDIT_NOVALIDATEONEXIT}
|
{$IFNDEF MASKEDIT_NOVALIDATEONEXIT}
|
||||||
//Do not validate if FValidationFailed, or risk raising an exception while the previous exception was
|
//Do not validate if FValidationFailed, or risk raising an exception while the previous exception was
|
||||||
//not handled, resulting in an application crash
|
//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
|
begin
|
||||||
//assume failure
|
//assume failure
|
||||||
try
|
try
|
||||||
//debugln('TCustomMaskedit.DoExit: try ValidateEdit');
|
//debugln('TCustomMaskedit.DoExit: try ValidateEdit');
|
||||||
FValidationFailed := True;
|
if (not FValidationFailed) then
|
||||||
ValidateEdit;
|
begin
|
||||||
FValidationFailed := False;
|
ValidateEdit;
|
||||||
|
FValidationFailed := False;
|
||||||
|
end ;
|
||||||
finally
|
finally
|
||||||
if FValidationFailed then
|
if FValidationFailed then
|
||||||
begin
|
begin
|
||||||
@ -1967,6 +1969,7 @@ begin
|
|||||||
if not TextIsValid(S) then
|
if not TextIsValid(S) then
|
||||||
begin
|
begin
|
||||||
SetCursorPos;
|
SetCursorPos;
|
||||||
|
FValidationFailed := True;
|
||||||
Raise EDBEditError.Create(SMaskEditNoMatch);
|
Raise EDBEditError.Create(SMaskEditNoMatch);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user